Kadane's Algorithm | Maximum Subarray Sum | Finding and Printing
HTML-код
- Опубликовано: 31 июл 2024
- Problem Link: bit.ly/3QhMl6j
Notes/C++/Java/Python codes: takeuforward.org/data-structu...
We have solved the problem, and we have gone from brute force and ended with the most optimal solution. Every approach's code has been written in the video itself. Also, we have covered the algorithm with intuition.
Full Course: bit.ly/tufA2ZYt
You can follow me across social media, all my handles are below:
Linkedin/Instagram/Telegram: linktr.ee/takeUforward
Time Stamp
0:00 - Introduction to course
0:41 - Problem Statement
2:13 - Brute Force Solution
6:12 - Better Solution
7:40 - Optimal (Kadane's Algorithm)
13:18 - Code
15:29 - Time Complexity
15:40 - Follow up question
19:37 - Outro
Please watch our new video on the same topic: ruclips.net/video/AHZpyENo7k4/видео.html
It's recursion!!!
lol i kept on clicking the link and its the same link (not recursion but yeah a loop)
13:56 "Do not carry any negatives into your future" - Striver
Even thought the context was different, it can be applied in our real life❤
TRUE
Let's march ahead, and create an unmatchable DSA course! ❤
Use the problem links in the description.
bro in case of printing we must have keep track of only last index, think of it,
bcz if after getting maxsum and startind and endind of subarray , if we further get the sum to be negative and then we put sum=0 and startindex to that index and think if we dont get any subarray that have sum greater than previous one, then we lost our startind and endind of main subarray ,then this will give wrong answer
so correct solution for it will be keep only track of endind, so next time when we get higher sum then only change it. and after getting maxsum we can easily get our subarray by using last ind, by going on left side of ind and rightside of ind
hey is it same for longest subarray sum
Couple of years back, I had watched the best video on RUclips(in terms of views) on Kadanes and still it was not very clear to me. And this video is so so better than the other video. Top level walkthrough.
P.S: I am not comparing. Else I would have told which video was that which I watched earlier :)
Love your explanation of progression of solutions and code walk through. Please keep making precise and amazing content like this. It really helps to stay motivated with solving problems because when I'm stuck, the logic in your vids is explained very clearly. Thanks a lot!!
weird how this explanation of kadans algo is so simple compared to other yt videos. short algo short code. superb
Nothing can describe how thankful we're to you for such amazing content.. . God Bless you Striver.. Hope you achieve everything you want ❤️❤️
Really amazed by the effort you put into making us understand. Thank you, Striver!
Understood! Super excellent explanation as always, thank you very very much for your effort!!
Complete concept clarity in 20 mins. Amazing ✅✅✅✅
Always ready for Dsa ✅
Haan Bhai
bro i really love your explanation ;how ever i explane doudtes to my frnds you explaining in same manner ❤
BEST Kadane's algo video on the internet!
Your way of explanation is really outstanding🔥🔥🙌thanks lot and more!!!!
i saw many videos but not able to understad.... this video gave me complete understading..Thanks bro
"Understood " superb intuition of algorithm !! awsome explanation i request everyone whoever watching strivers vedeos do like and comment!!!
Printing the subarrays part is something i learn this time tysm understood:)
Thank You so much for made this crystal clear understanding about this problem.
i was very keen about learning DSA and your sheet and your explanation has boosted this thank you strive bhaiya
in love with kadane algorithm...all thanks to you bhaiya
Easiest explaination ever👌👌 thanks bhaiya...!!
Crystal Clear Understanding !
Thank you very much bhaiya for these.
In upcoming videos please add general approach for techniques like sliding window, two pointers etc techniques as the way you give for recursion and dp etc.
Thank you once again bhaiya
12:28
very nice explaination. Very helpful walk through that cleared my confusions
Understood....Thank You So Much for this wonderful video.....🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
understood you are the best teacher. 🙌
Understood, Amazing Lecture Sir!
Kadame's Algorithm is now clear. Thankyou Striver ❤
From brute(TC -> O(N^3), SC -> O(1)) to better(TC -> O(N^2), SC -> O(1)) to Optimal(TC -> O(N), SC -> O(1))
Im new to programming and this was very helpful ~
you are doing great job striver ❤.. .
Absolutely Amazing ✌️🔥
Super explanation with so much love 😃
Very detailed explanation, it is language agnostic as well, thanks for the video
great concepts , understood everything
Understood,Thank striver for this amazing video.
Understood. Thanks a lot. Please upload more videos Bhaiyaaa.
Amazing!! Keep going bro⚡
Bro really you have good knowledge of DSA...
i am following this course for my dsa preparation , its an amazing course and explanation by bhaiya
just want one thing complete this by end of october ♥♥
have u completed
Understood!.Thank you.
All videos are very helpful
Time Stamp
0:00 - Introduction to course
0:41 - Problem Statement
2:13 - Brute Force Solution
6:12 - Better Solution
7:40 - Optimal (Kadane's Algorithm)
13:18 - Code
15:29 - Time Complexity
15:40 - Follow up question
19:37 - Outro
There's always something new to learn from striver's videos . Thank You bhai for posting videos without any long gap!!!.
Understood.. thank you so much bro
Thanks brother Best Explanation😊
Understood. Thanks a ton 😇
simply , loved it....
Understood. Thank you.
BEST TEACHERRRR EVERR!!!!!!!!!!
Thanks bro, just subbed to the channel
UNDERSTOOD SIR🙇♂❤🙏
Understood and thanks for the video
Thank you so much for the video
Completely Understood!
loved it!
understood ,thnx for the video ❤❤❤❤❤❤
Best explanation everr
Great job👍🏻
your course is too good
Understood Boss, it helps !!
Awesome!!
Incredible 🎉
Understood ❤bhaiya❤❤
Amazing experience
thank you very much brother.
Understood thanks 🙏
SDE Sheet Day 1 Problem 1 Done!
Understood!!❤
UNDERSTOOD !!
Thanks for explanation
Understood, thanks :)
Understood✅🔥🔥
Thank you 🙏
amazing video sir
Understood 🔥
Great work
Understood striver! 🔥👍
Understood bhaiya!
Good explanation.
Amazing ❤
Understood Sir!
mind blowing sir
Thanks so much striver
Thank you!
thank you sir❣
Thanks a lot!
Understood ❤
done and dusted ! hats off to striver ..
super understood
at 15:22 you have to add this code in for loop . if(maxi
Understood!
understood
// first time bro
Understood !!
thank you sir
understood
Thanks a Lot
understood !!
Understand Brother.
You the best❤
Can't wait for binary search series
understood 😇
Thanks bhaiya 💖💖