Maximum sum subarray using commulative sum

how u came about the logic ?not able to understand

Please elaborate what your doubt is??

You should post proper link to problem and your code, in which you are facing the issue.

Its cumulative sum, which refers to sum of all the elements upto that index.

In maximum subarray question, you need to find the subarray which has the maximum sum, and then print this maximum sum. you can do it with various method. The best and most efficient method to solve it is using the Kadane’s algorithm.

i am asking about the 2nd video solution of this problem, i am not able to understand

There are 3 solutions for this problem.
Each with respective complexity of O(n^3), O(n^2) and O(n).
They are very well explained in video. You should focus more on the most efficient solution that is using the Kadane’s algorithm, which is in O(n).

i want to understand all the ways ,the brute force approach,the less complex one and the most efficient one,i have understood kadane,can u help me with the 2nd approach ?

What doubt are you facing the second approach? It is pretty simple.

I would recommend you to watch the video again 2 times. I’m sure you’ll get it.