Failing cases for any problem

Hello @all
if any one has WA in some problem then how can he think of the critical cases.if there are some corner cases for which most contestants fails how can they get that special case.


Hello @ajay154,

The so-called “corner cases” are actually a somewhat important part of almost any programming problem.

They are the cases that will ultimately define the correctness of your algorithm for some “critical” values:

they can be an empty string, the value 0, some precision roundoff error and alike things.

The best way to handle them, is to first focus on developing an algorithm that works for the majority of the cases and afterwards consider these special values separately…

Experience helps a lot on this case :smiley:

Best regards,



@kuruma thanks for your reply…i always solve the problem with correct logic but always get wrong answer due to failing some test cases.can you give me some references where i can learn debugging of a C code.

1 Like

Well, in terms of finding corner cases yourself, I would advise you to attempt and LOOK (you don’t even need to solve them) at some of the Codeforces website problems.

This is because there, all test cases are available… And you can somehow understand HOW a setter builds corner cases.

Note: This is not advisable to do, since looking directly at test files can harm your ability to think more creatively, but, as a start, it might be a good idea :smiley:

The rest is nothing but experience :slight_smile:
Stay tuned for my next contest problems to train :wink: I shall remind of you when discussing corner cases :wink:

1 Like

thanks i will try it…