J.P. Morgan interview question

Was asked a string manipulation question and also a sorting question.