Can we have better solution than O(n^2 log n) for the following problem 1.
Problem 1 from Past Online assesment of Citadel