GGCURR - Which cases am I missing ?

Ignoring the time complexity of the below inefficient algorithm, it is surprisingly giving WA. Which cases am I missing ?
Link to Solution :
https://www.codechef.com/viewsolution/12603389

Your temp variable is being allowed to become negative before being tested for divisibility, which is why it gives WA. I’ve pointed it out here. Take a look at the output. Apart from this I don’t think there is any other bug.

1 Like

Thanks for the time and pointing it out.

No problem… the little bugs are the hardest to find :slight_smile: