I was trying to solve this problem, after submitting my solution I got TLE and I couldn't figure out the problem with my O(n.log(n)) solution, I also checked some accepted solution and most of them are using the same approach?

**UPD**

I got accepted by copying someone sort function but I still want to know what's wrong with java.util.Arrays.sort function?