Two almost same solution in java one gets AC and another one gets TLE??
Difference between en1 and en2, changed 285 character(s)
So I just found out that my [solution](https://codeforces.com/contest/1593/submission/131883677) which is almost same as [this one](https://codeforces.com/contest/1593/submission/131880221) gets TLE on test case 8 while latter got AC.↵

I can't figure-out why this happened?↵

Problem link -> [C.Save More Mice](https://codeforces.com/contest/1593/problem/C)


Solution:↵

It turns out that Arrays.sort() in java uses Quicksort which has worst time complexity of O(n^2) and Collections.sort() uses that has time complexity of O(nlogn).↵

refer to [this](https://www.geeksforgeeks.org/quick-sort-vs-merge-sort/) article for more information.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English insane_banda 2021-10-14 05:14:37 285
en1 English insane_banda 2021-10-14 04:00:23 431 Initial revision (published)