LeetCode Challenge Day 3 - Max Subarray

preview_player
Показать описание
Max Subarray and Kadane's algorithm. You should already know this if you prepare for coding interviews. Make sure to check out an alternative solution at 7:05 though!

Subscribe for more educational videos on algorithms, coding interviews and competitive programming.

#Coding #Programming
Рекомендации по теме
Комментарии
Автор

Also, I should have just used a=max(x, a+x).

Errichto
Автор

* gets 2 nd place in codejam qualifiers*
"Ok that was boring, let's make a YouTube video now"

cobrandrewg
Автор

Errichto, I dont know if anyone has noticed but you have got an unknown side of a good sense of humor.
Also, thank you so very much for helping hundreds of thousands of guys out there. Keep up the good work

ritiktwopointo
Автор

who didn't know about Kadane's algorithm ? ✋ (me)

pratikchandraIC
Автор

3:17 the question that comes on my mind while I solve new problems.

subarukun
Автор

Don't stop with this series I'm learning so much!!!

camenraidercc
Автор

I got this exact problem as a homework question recently, spent hours on it until I finally came up with this algorithm. Little did I know, it was one of the most well known programming interview questions...

FromTheMountain
Автор

Makes me smile when I see the missing “int a = 0” after the amazing quick modification to handle the negative numbers.

rickyleung
Автор

I solved three problems in google Code Jam so far and I saw you as top two! You are so good!

junghoryu
Автор

This is like the speedcubers who plan the entire solution before making their first move.

sarahb
Автор

If you don't know the algorithm then read the book mentioned by Errichto in the beginner cp video, it is great!

We can alternately keep the first element in the ans and then use loop from i = 1 to n and apply the kadane's algorithm, it will also work.

lovvyparhar
Автор

Your explanation is so effortless . Easy to understand ..

flyingcanopy
Автор

first time seeing this, proud of myself that i was able to come up with the alternative prefix sum algorithm within minutes. Never heard of kadane's algorithm before.

olayinkaanifowose
Автор

Dude, great videos. I like that you mess up sometimes. It helps me, as a viewer who doesn't participate in competitions, to keep in mind that it is not necessary to get the code correct in the first try . You try and figure out what is wrong and correct it. And when you get it right, it's great. So thanks and best of luck for your future.

Shounak
Автор

i laughed too hard when he said "am i stupid or something"

aayushlamichhane
Автор

Amazing Errichto Just Amazing . One of the best things is to learn how smart people think when solving

rockyjoe
Автор

"In this episode of Errichto complains ...." -- these videos are great!!
This basically boils down to a typing exercise for you!

jimwoodward
Автор

Thanks for educating me, the single person!!

erikawwad
Автор

Well you are a genius, and I can certainly say so as I've never seen someone code it twice and under 20s and then saying "Well the problem statement is". 🙌

imml
Автор

"Measure myself" - instantly corrects xD

_Ani_