0
How to solve time limit exceeded error?
here's the code https://code.sololearn.com/ctw50XARmTLX/?ref=app
2 Antworten
+ 3
DjBox61 please check first line of your comp function...
it is as below :
for(int j=1;j<b;b++)
with this , you are doing initialization of j as 1... adding 1 everytime to your number b by b++... so, you are never going to have j<b ... so, it is infinite loop and you get time exit notification..
change as below and you are done :
for(int j=1;j<b;j++) //j++ instead of b++
+ 1
thank you