I have seen sometimes when I sort array it gives TLE but when I sort ArrayList code gets accepted why so?? I have added 2 codes in the first one I have used array, got TLE and in the second one i use arraylist and it got accepted.
(I googled but did not found the reason)
TLE when I used array: https://mirror.codeforces.com/contest/600/submission/104404543 Accepted when I use ArrayList: https://mirror.codeforces.com/contest/600/submission/104404966
Thanks.