You are not logged in. Please login at www.codechef.com to post your questions!

×

TIME LIMIT EXCEEDED,HELP

please help for how i can remove TLE error from it

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

asked 15 Jan, 00:35

sachin_722's gravatar image

2★sachin_722
1
accept rate: 0%


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/

link

answered 15 Jan, 04:17

oleg_b's gravatar image

7★oleg_b
2574
accept rate: 17%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×204
×40
×38

question asked: 15 Jan, 00:35

question was seen: 121 times

last updated: 15 Jan, 04:17