What border cases am I missing in this problem? (DWW19I)

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

1 Like

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!

1 Like
Hint

Line 19 is wrong.

1 Like

Thanks. Very silly mistake on my part