Jacops Interview Question

Two problem about sorting arrays