Not getting the correct output here is my code:-

Hello @anshulgurawalia what is the value that you are storing at r[n-1]?

sir it wil be r[n-1]=arr[n-1],where n is total no of element in the array

See line 11 it should be cin>>arr[i];

1 Like

now the code is not passing the test cases

Hello @anshulgurawalia as the constraints are larger so declare the array globally and take datatype as long long int.


i am sorry for the delay there was some network problem.
Happy Learning!!

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.