No, actually my input output matches exactly for the given test-cases but when I submit it doesn’t gets accepted because of which I’ve been losing a lot of rating lately
LOL SAME. I enrolled today on CodeChef to try it out on a friend’s recommendation and this was the first problem I decided to work upon and this happened
There are some hidden test cases also, your code failed on some hidden test cases. The correct answer on sample test cases doesn’t ensure your code is completely right.
These are the just the example / basic test cases, on which you are doing fine. But these are not the complete cases. There are hidden test cases / corner cases on which the logic you implemented fails. System won’t mark your answer as correct because it is, in fact, incorrect. There is a flaw in your logic. Try to think of cases where your code might not give correct answers.
@rash20000 Your code is fine. You just made one silly mistake. The size of array should be 10 and not 9.
Please see following link, I used your code (only change is size of array ) :