Even N^2 Solution is passing


#1

Is it a question we can do it in O(n log n)