This code is producing the wrong output for the input -
8
16 17 15 0 20 1 1 2
can you please check?
Why my code is producing the wrong answer for 3rd input?
@subham221 the output is 23 and is correct!
make sure to give -1 at end!
also for online submission, check the data type for overflows along with array size!
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.