The code explained in the video does not work on following test cases.
INPUT -> 2 0 2 3
EXPECTED OUTPUT -> 7
OUTPUT -> 5
The code explained in the video does not work on following test cases.
INPUT -> 2 0 2 3
EXPECTED OUTPUT -> 7
OUTPUT -> 5
Please share the link of Code
How to Share Link of Code??
paste your code at https://ide.codingblocks.com/
click->file->save
after a link will be generated at top in place of url something like: https://ide.codingblocks.com/s/12345
share this link
add this condition in your code
if(i==0)Current_Sum=Cumulative_Sum_Arr[j];
else Current_Sum = Cumulative_Sum_Arr[j] - Cumulative_Sum_Arr[i - 1];
this is because otherwise it is accessing Cumulative_Sum_Arr[0-1]==[-1] which will give wrong ans
Modified code
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.