Блог пользователя HaydarFakhoury

Автор HaydarFakhoury, история, 22 месяца назад, По-английски

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
  • Проголосовать: не нравится

»
22 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

maybe use a piece of paper to list all situations

»
22 месяца назад, # |
  Проголосовать: нравится 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.

»
22 месяца назад, # |
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 failed
Like 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!