All test cases not passing

Pls see the code and help

Now it’s working https://ide.codingblocks.com/s/321329

Didn’t understand what was problem in mine and what changes you made?

I made the outer loop for length , so it starts with 1.
The way you were marking the visit array was incorrect, you were marking from j to i, where j was starting and i was length, instead you had to do it for index j to j+i.
Also need long long int to store big numbers

1 Like

Hey tried it and now the code i have written is failing 1 test case

Now it’s working https://ide.codingblocks.com/s/328299

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.