-2

In various codes where time limit exceeded, by using while(t-- >0) instead of while(t--) code runs successfully. I don't know about while(t-- >0) , I read it somewhere in the codechef examples solution.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982

1 Answers1

-1

In practice, they are equivalent. It's just a matter of taste. Some think that while(t-- > 0) is clearer than while(t--).

As long as t is not negative, the two are completely equivalent. But on the other hand, a negative t would most likely indicate a bug with a loop like that.

klutt
  • 30,332
  • 17
  • 55
  • 95