Can someone please help me out? I cannot understand why my solution is giving WA. It passes all the sample cases. Where is the flaw?
Question Link : RPDRDNG Problem - CodeChef
My solution : CodeChef: Practical coding for everyone
Edit 1 : After @aryanc403 pointed it out, I realized the solution fails for
1
1
1 2
So, I fixed it, but I’m still getting WA. :-((
Here’s the updated solution : CodeChef: Practical coding for everyone
Any ideas would be most helpful! Thank you.
Edit 2: Solved! Turns out the if-statement had to be bracketed. Learnt a big lesson today - never mess with syntax… Its much safer to write properly bracketed and indented code. Cost me a lot in yesterday’s contest.
Special thanks to @uttaran_das for pointing out the Test Case which prompted me to run a complete line-by-line debug. Also, to @aryanc403 for pointing out that base case error.
Thanks a lot guys!
Here is the correct solution : CodeChef: Practical coding for everyone
Moral of the story : Never mess with syntax …