0

Time limit exceeded

I have a problem: the code is written, but the time limit is exceeded. How do I rewrite the code to make it work? https://code.sololearn.com/cyw7t0g41BOh/?ref=app

8th Aug 2018, 4:04 PM
Komunre
Komunre - avatar
5 Respostas
+ 3
A for loop works like this: for(declare variable; condition; raise variable) You put candy++ where you should have put the condition, so it will never return false and the loop will never end.
8th Aug 2018, 4:10 PM
Moritz Vogel
Moritz Vogel - avatar
+ 1
change for( ... ; ... ;) to for(; ... ; ... )
8th Aug 2018, 4:07 PM
Bebida Roja
Bebida Roja - avatar
0
Thanks
8th Aug 2018, 4:24 PM
Komunre
Komunre - avatar
0
Moritz Vogel I think like you said it will never return false instead of true🤔🤔😂
8th Aug 2018, 7:04 PM
Jonas Schröter
Jonas Schröter - avatar
0
Moritz Vogel Just edit it and we'll delete the other posts.
8th Aug 2018, 7:10 PM
Jonas Schröter
Jonas Schröter - avatar