Getting W.A. can anybody provide me the test case where my solution is giving W.A. Problem link: TACHSTCK Problem - CodeChef … and … solution link: CodeChef: Practical coding for everyone thanks to all of you in advance…
A very small test case where your code fails is:
- 5 2
- Correct answer for above test case is 2 but your program out putted answer is 3. I saw your approach, your logic is correct but there is a small bug in your program, i hope you can identify it with above test case.
- if you cant comment below i will help you. happy coding
there was a small bug in program at line no 22 just replacing
for(i=n-1; i>=0; i–) with
for(i=n-1; i>0; i–)will solve the problem…