0

How to solve time limit exceeded error?

here's the code https://code.sololearn.com/ctw50XARmTLX/?ref=app

1st Sep 2018, 9:53 AM
DjBox61
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++
1st Sep 2018, 10:31 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
thank you
1st Sep 2018, 10:40 AM
DjBox61