Two Sigma Interview Question

array sorting and recursion type question