by Epholys · 7y ago · 0 comments
EDIT: yep, after reading the comments below I see that I really should have put just a little more thought before dismissing this as too trivial to think about.
The counter solution simply needs to check that the counter is non-zero before decrementing.
All cases then work perfectly.