Passing 2 out of 3 testcases

https://ide.geeksforgeeks.org/gZrNh8oK9I

@sattyrajpoot39
Use long long int instead of int in your code. Also run your loop till <n-1 only.
for(int i=0;i<n-1;i++)

This is because you are using a[i+1] and b[i+1] in your calculations and thus when i is equal to n-1 , your code accesses invalid memory locations and give wrong answers.

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.