Goldman Sachs Interview Question

DSA Question on sorting. Along with some optimization techniques