GUYS PLEASE HELP ME SPEED UP THIS PROGRAM. IT PASSES THE SET TIME LIMITATIONS . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

GUYS PLEASE HELP ME SPEED UP THIS PROGRAM. IT PASSES THE SET TIME LIMITATIONS .

Hey People! This question succesfully passes the first as well as second subtask, however for the second subtask- It exceeds the time limit of 1 second and in turn takes close to 2 seconds. I am just in the midst of learning programming in JAVA, thus i wanted a few suggestions from my fellow coders to make my program considerably fast and fit within the time frame.This program is one of the 2 problems that was asked in the 1st stage of selection of Team India for the most prestigious competition for high school programmers. https://code.sololearn.com/cSAprcWd2G3V/?ref=app

18th May 2020, 3:55 PM
Akash Singhania
Akash Singhania - avatar
5 Answers
+ 3
The Outrageous Indian your welcome, happy coding!
18th May 2020, 6:07 PM
KingDaniel2004
KingDaniel2004 - avatar
+ 2
Use quick sort instead of selection
18th May 2020, 4:06 PM
KingDaniel2004
KingDaniel2004 - avatar
+ 2
The test case which failed... would have contains thousands of data... For large data. Use fastest sorting algorithm such has quicksort, merge sort etc Selection sort is not good(slow) for large amounts of datas
18th May 2020, 4:09 PM
KingDaniel2004
KingDaniel2004 - avatar
+ 1
And by the way is that problem from hacker rank? Thanks
18th May 2020, 4:10 PM
KingDaniel2004
KingDaniel2004 - avatar
+ 1
Thank you so much..!!
18th May 2020, 5:01 PM
Akash Singhania
Akash Singhania - avatar