State Street interview question

2 Pointers approach sorting and array