0

Can anyone please help me to optimize this code as, it is giving time limit exceeded error for large values.

It basically deals with array rotation. I know there are many methods to do so but pls do not give a new method as the answer. Just help me to optimize this code so that it can run for large values. https://code.sololearn.com/c15dAfJCO13Y/?ref=app

5th Mar 2020, 6:51 PM
Aryaman Mishra 🇮🇳
Aryaman Mishra 🇮🇳 - avatar
6 odpowiedzi
+ 3
Because the SoloLearn playground is limited I would say to change playgrounds for the continued testing. But the code is valid and appears to be optimized as far as SoloLearn. I was able to go outward 8 digits here as far as testing. Best test was at 4 ...
5th Mar 2020, 7:04 PM
BroFar
BroFar - avatar
+ 2
Your code is not throwing an error once I removed some space https://code.sololearn.com/cukiT0338BeF/?ref=app
5th Mar 2020, 6:57 PM
BroFar
BroFar - avatar
+ 1
Yes. But it's still giving time limit error. What can I do to execute it faster.
5th Mar 2020, 7:01 PM
Aryaman Mishra 🇮🇳
Aryaman Mishra 🇮🇳 - avatar
+ 1
Yes sir it is working here but not on other platforms like HackerRank, i.e in a similar question 8 out of 10 test cases are running and rest 2 are showing time limit exceeded error.
5th Mar 2020, 7:07 PM
Aryaman Mishra 🇮🇳
Aryaman Mishra 🇮🇳 - avatar
0
https://code.sololearn.com/cgwlrxV06Xer/?ref=app Actually the problem was in the algo of my code. But I am sure this code will work in every possible case.
6th Mar 2020, 7:54 AM
Aryaman Mishra 🇮🇳
Aryaman Mishra 🇮🇳 - avatar
0
p.s this is the corrected code.
6th Mar 2020, 7:54 AM
Aryaman Mishra 🇮🇳
Aryaman Mishra 🇮🇳 - avatar