Maximum Sum Subarray Problem - Kadane's Algorithm - Brute Force to Optimised - Dynamic Programming

preview_player
Показать описание
This video explains one of the most common question asked questions in interview of Amazon, Flipkart, Paytm , Samsung etc.

Master Data Structures and Algorithms

Maximum Sum Subarray Problem is solved in o(n) time complexity using Kadane's Algo but if you are not aware of the algorithm you can solve this problem using brute force approach that has time complexity of o(n^3) and then we further optimise it to o(n^2).

We first understand the idea behind the algorithm and then see how to implement Kadane's Algorithm.
Рекомендации по теме
Комментарии
Автор

I watched 5-6 different videos for this problem. But this was the best explained. Thanks PrepBytes!

kumardivyanshu
Автор

Your way of teaching method is really good

srivanis
Автор

BEST KADANE'S ALGO TUTORIAL ON YOUTUBE !! The way you solved it was just awesome. Thank you.

siddhichavan
Автор

Best explanation on Kadanes's Algorithm on YouTube!

otismilburn
Автор

This is the best explained video on Kadane's algorithm in YouTube!!

sarfarazhussain
Автор

superbly explained i think best on youtube THANKYOU SO MUCH MAM

kumarvivek
Автор

One of the best explanation I found after a long day search 😃..

AmandeepSingh-otst
Автор

Best explanation ever simple and easy to grasp.

thelogicalladka
Автор

Why this question is not available on prepbytes practice section (unpaid section)

rohitkumar-gibo
Автор

I appreciate your efforts 💯, it was worth watching.

everythingseeker
Автор

I appreciate😊 👏👏your effort, thank you so much mam, I understand that concept clearly 💯💯

srivanis
Автор

wow thanks for your explanation..it is very clear

digilearncommunity
Автор

If we consider the first two element, the max sum is 10. But here max sum for first two element is -10 ? Why?

DebarshiKundu
Автор

this is the perfect way to approach a question

financewithsom
Автор

Thank you for such a detailed explanation. really helped me. Thank you again.. Keep making quality videos like this.

rishikeshmishra
Автор

Can you give the code for cubic tym complexity....I am trying but can't run it

anubhavsaha
Автор

Your diagram for brute force will be wrong if negative number is considered

baibhavghimire
Автор

Let say ur array is [1, 2, -2, 4]. For this maximum sub array sum should be 3. But this approach will give 7.
Is something wrong ?

ravikant
Автор

Never knew that this is a dynamic approach 😐

AmandeepSingh-otst
Автор

this won't work for all test cases..suppose if u have 100 inplace of -100 then ur max will be 175 and it's not contiguous...have a look if i m wrong!!

singhaman