About the problem Carvans and my code

Why I’m getting wrong answer? Am I missing any corner case or anything else?
My solution: CodeChef: Practical coding for everyone
Problem link: CodeChef: Practical coding for everyone

Your code is giving wrong output on several test cases including this one
2
5
8 8 8 8 8
3
11 12 12
The correct output ;
5
1
Your output
1
1
What you are doing is you are just checking with the front car , You have to consider every car

1 Like

Thanks!! I have solved it! Thanks for the test case!!!

1 Like