How should i think in order to get better test cases for a problem?

Many times ,During contest code runs fine for given test case and randomly choosen case. but even you get wrong answer .
So , i want some advice regarding building useful test cases so that it can fetch you to Accepted verdict.
Thanks

1 Like

Think out of the box :slight_smile:

2 Likes

But, i don’t know the dimensions of box :laughing:

1 Like

Practice is the key the more u will practice the more better ideas your brain suggest to u.

1 Like

Try to write down a formal, (and by formal I mean very formal), proof for your algorithm. While trying to prove your algorithm you’ll stumble upon counter example test case for your algorithm.

If you are using any greedy approach, you should always think twice about it’s correctness before implementing it!

That is the hidden think you need to detect :slight_smile:

1 Like

Then there would be no difference between Codechef and Hackerearth :grinning:.
When they don’t reveal the test case, it will allow you to think for correct solution.

2 Likes

Yes, this can be done while we are practicing or upsolving contest question.

I think this thread discuss this query in detail.