How to remove the wrong answer due to some not tested test cases?

Can anyone please tell me that how can I get to know that my program is not holding this test case? Is there any website or anything by which I can get to know about this, or does it comes only by experience and deep thinking?

I took too much time to make my solution accepted, due to wrong answer, for not considering some test cases.

There is no such provision on codechef via which you can see where you went wrong. What I believe is, there is a big difference between a good programmer and a good coder. We have to be both. If anyone’s telling you what you have to do and handle everything, you can surely do that. But what if you’ll have to do something independently? For doing a question, you have to be good in all and that;s why I suppose we are practising here. Thinking about the logic enhances your logical thinking, coding and optimizing it makes your coding skills better , thinking about all possibilities makes you a good tester!! This may take time and involves deep thinking sometimes, but the end result is always good and enlightening. Failing in finding the faults is not only with you, but with us also. So, just try think all different ways and test your code fr every kind of input you can. For example, if you have some array as your input, then think what all can be in array:

-> array of numbers or characters(usually)
-> If numbers, then numbers can be both +ve and -ve
     ->Also, there may be duplicate numbers in your array
     -> Numbers can be integer, floating point(see for correct datatype)
->If characters,
     -> check if you are handling the range properly, like 'a' has 97 ASCII value, many times we 
        index it in improper manner, we want to do a[97-97] to denote that a[0] is 'a'. So, keep this check.
    -> You took a big integer number input as a character array, then you must be dealing with the integer values represented by the characters. i.e.array like "1234" then we may be needing, '1' as the integer value 1 and so on. We need to do '1'- (ASCII value). We sometimes forget this and that produces incorrect results.
->Also, let input be some variable n and n lies in range [1,10] then test for n=1,2,5,9,10. You may also want to test on 0 and 11. Sometimes it helps.

Similar manner, many more cases can arise. So, go in depth and test properly. Sometimes, even the most weird test case results in WA. Also, if you want to analyse very completely, you may like practising on codeforces. Their test files are visible. But usually what happens is, we are more tempted to see the test case our code is failing at instead of devoting time to think about it! And imagine what more you may learn when you think about something new. So, directly seeing it will leave many noticeable things unnoticed.

Happy coding… :slight_smile: