Goldman Sachs interview question

One Dp question One String sorting question