Amazon Interview Question

Leetcode array manipulation very easy, then a sorting based leetcode one