How can we start loop from i=0, because curr_sum is being calculated as arr[j]-arr[i-1], so -1 would pick any garbage value? What is the solution to this?
Maximum Subarray Sum approach Cummulative Sum
to avoid this simply put one if statement and handle i=0 case seprately
Done that but still not working for the input as 5 4 3 2 1.