Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

### HaydarFakhoury's blog

By HaydarFakhoury, history, 10 months ago,

How can I effectively think of potential test cases that might break my approach when solving competitive programming problems? I often find it challenging to identify test cases that could potentially challenge the correctness of my solution, even after finding an approach. As a result, I may think that my approach is correct, but there could actually be a test case that my solution does not handle correctly, which I failed to consider. How can I effectively find and consider these test cases?

Not sure If everyone has or had these struggles before but I've never seen anyone point it out. Could just be me, who knows.

• +2

 » 10 months ago, # |   0 maybe use a piece of paper to list all situations
•  » » 10 months ago, # ^ |   0 Coming up with the different situations is what’s hard. But no you’re right using a piece of paper could help. Thanks
 » 10 months ago, # |   0 I think about problems in a very brute force approach so I often approach the problem as how to reduce redundancy and improve efficiency. Although many times, it often comes down to pattern recognition to know what works or not.
•  » » 10 months ago, # ^ |   0 Makes sense thank you!
 » 10 months ago, # | ← Rev. 2 →   +1 What I do is implement an approach(I mostly don't check before the first submission and do the following after doing a wrong submission but its not a good practice)Your steps should be contradictory that how your solution can be failedLike What I did in yesterday's E(but was unsolved till the end of the round) :Maybe my choice for now is making problems for the next choices and I reached to approach in which we can change the signs of a[i] and a[i+2] without changing a[i+1]And the real solution was I can change the signs of a[i] and a[i+k] without changing any of a[i+1],...,a[i+k-1] I don't know if this would be or not but ...I hope this would be helpful!
•  » » 10 months ago, # ^ |   0 Thanks!