Maximum Sub-Array Sum (LeetCode 53) | Kadane's Algorithm | Study Algorithms

preview_player
Показать описание
Maximum sub-array is a programming challenge on LeetCode. You are provided with an array of integers. These elements could be all positive, all negative or a combination of both. A sub-array is a smaller array formed using the elements of the original array. The condition for this problem is that the elements of the sub-array should be contiguous. Out of all the contiguous sub-arrays possible we need to find the maximum sum that can be formed. Watch the video to understand the problem in a simplified manner. I then work along with you to solve it first using a Brute Force approach, and then an efficient approach. All along with visuals and explanations.

00:00 - Intro
00:29 - Problem Statement and Test Case
02:15 - Brute Force Method
04:15 - Optimized Solution
07:10 - Dry-run of code

📚 Links I talk about in the video:

💻 Get Social 💻

#leetcode #programming #interview
Рекомендации по теме
Комментарии
Автор

Why is your channel still less than 500k subs, honestly cabt believe it 🎉🎉Good content out herr hust saw your channel today

pianolessonswithbless
Автор

Thank you so much. Your videos are really helpful for me in understanding how to approach these problems.

anonlegion
Автор

Hey, Your awesome, Please do more videos on frequently asked questions .Please do more content you will get million subscriber's because your content and white board, practical code walk is awesome. Once content grows more you will start to see many subscribers because we like your explanation. I just told my whats app group friends and they will subscribe soon.

srin
Автор

I'm afraid of this problem because of it's name "Kadane's Algorithm" ... After ur video I went to GeeksForGeeks and solve this also solved it in Leetcode...
Thankyou so much!!... I thought DSA is very hard for me..But ur explanations made it very easyy!!

topricano
Автор

The explanation is so good!
Thanks brother

omsudhamsh.h
Автор

why are we taking values from 3 (4th index) on wards (right to left) why not we start with 2nd and 3rd indices is there any reason for that

kalyanamvenumadhav
Автор

Thanks brother.
The explanation is great and your dynamic programming playlist is awesome.

One question:
What if we are asked to find that subarray start and end indexes as well ?
How we will find ?

kishanraiyani
Автор

I didn't get which are step 3 and step 4 you are referring to in code comments. Also how those steps are equivalent to the code statement. If possible, could you please relate and elaborate?

pallavichaudhary
Автор

why is the sum of the lone element -2, 2? at 3.27

Itsallrelative
Автор

6+5+1 also would be a max sub array na? I am not getting how 7? Please can you explain

priyakoli
Автор

Hello sir, where i can find this problem in leet code

Nayak___