+ 2
How can I deal with exceeding the time limit?
I've been making some python code but every time I use a somewhat large number , make use of larger or recursive function , I get the message "Time limit exceeded" when I run my code . For example , in this code ,I get this message when I input more than 40: https://code.sololearn.com/cPh9Yx5mDxQd/#py .Is there any way of dealing with it or I should code somewhere else?
5 Respuestas
0
Exceeding the time limit means the program you are using is doing more computations than expected. In other words, with your given looping, the acceptable is within a 1-2s time limit. I recommend trying to rewrite your code, however, I do not know any other line you could write to "cancel" the error.
+ 4
Do you suggest I should download Python and write my code there?
+ 2
Could you please recommend a platform which allows a longer (i.e. 1 minuta) time limit?
+ 1
Using recursion is actually very tedious for the computer to handle, and the error is displayed when there is a stack, or memory, overflow.
+ 1
Here, I used the standard dictionary method:
https://code.sololearn.com/ccVJqB4IWXem/#py