How to look for corner cases?

Hello there everyone!
A total newbie here.
I would like to know how you guys debug your code concerning corner cases.
Second, how do you debug your code in such a small time range.
This month’s cookoff was my first contest with such low time limitations.
Well, I was able to solve one of the problems, but unfortunately that was after the contest ended :sweat_smile:
Profile link :
Any suggestions are welcome.

There’s a popular trick. You make two program, one that uses brute force approach to solve a problem, and second a random test case generator. Then you generate large random tests and pass them to both the “actual answer” and brute force answer and check where they give unequal result. It’s specially helpfull in long challenges, and for short challenges it’s all about practice :smile:


I see…
Thank you :smile:
Hope I will be able to improve :sweat_smile::sweat_smile:

1 Like

Best of luck :smile:

1 Like

This has saved me so many times. It’s absolutely, absolutely invaluable.

Less useful for finding “worst case performance” corner cases and overflow errors, but great for teasing out small (or large!) logical errors :slight_smile: