Problem Link: CodeChef: Practical coding for everyone
My solution: CodeChef: Practical coding for everyone
Problem Link: CodeChef: Practical coding for everyone
My solution: CodeChef: Practical coding for everyone
Here is a test case that your code fails on:-
1
1
3
Actually N can also be 1, which you aren’t assuming. I think you missed the constraints. Your code assumes N \ge 2. So consider this case:
N = 1, A_{1} = 43 (Assuming 1-indexed representation)
Your Code Prints:
1 1
Correct Output:
43 1
Hope it helps!
Cheers!
Happy Programming!
Line 19 is wrong.
Thanks. Very silly mistake on my part