TIME LIMIT EXCEEDED,HELP

please help for how i can remove TLE error from it

MY SOLUTIN IS----
https://www.codechef.com/viewsolution/22485054

https://www.geeksforgeeks.org/sorting-algorithms/ has a good overview of the sorting algorithms. What you implemented is “Bubble Sort” with the time complexity O(N^2) hence the Time Limit Exceeded solution status. You may want to consider more efficient sorting algorithms. For this particular problem - due to the given constraints - a good choice is Pigeonhole Sort: https://www.geeksforgeeks.org/pigeonhole-sort/

2 Likes