Limits: 1s, 256 MB
You are given an array A with N elements.
You have to sort the array in ascending order. In one move, you can sort the first N-1 elements or the last N-1 elements.
This is a companion discussion topic for the original entry at https://toph.co/p/sort-the-array