Jacops interview question

Two problem about sorting arrays