Finally makes sense! After reading multiple articles and watching other videos, this one finally connected all the dots for me. Thank you for the clarity!
@gmanjapan3 жыл бұрын
Thank you for the explanation. Much better than others. There's a bug in your pseudo code toward the end - following the python style where your code blocks are indicated by indentation, before you settle on appending a 0 to the end of the heights you had an example of emptying the stack, but that code is indented to be inside the loop instead of after the loop.
@SameerSrinivas3 жыл бұрын
Now, this is what I call a complete end to end solution. I went through other explanations with no luck. You did an awesome job explaining with such clarity and quality. Tremendous job. Thanks a lot. Keep it up!
@naheedray4 жыл бұрын
I didn't thought the content would be that great. It turned out to be the best. Thanks for saving my day💜
@adithyapvarma87383 жыл бұрын
Damn. This question finally makes sense. I have been scrounging the internet to find a proper explanation for this question. Thank you kind sir!
@iminsane77773 жыл бұрын
Understanding thought process helps in solving not just one problem but a lot of similar problems. Love how your code evolved with your thought process.
@arungoli90604 жыл бұрын
I have watched 5 videos for understanding the solution and finally in the 6th video I understood the solution. And this is the 6th one Thank you
@meht84 жыл бұрын
For anyone looking to get comfortable with mid-level algorithm problems, this is one of the best resources here.
@redomify3 жыл бұрын
Omg thank you for this! None of the other vids i checked added any clarity.. but this definitely did! Your animations really helped
@AbhrajyotiKundu003 жыл бұрын
This is the Best Explanation for the problem out there. Simply WoW!
@samarthsoni61033 жыл бұрын
Really great video.... please please upload more !!
@kunzhou51593 жыл бұрын
This is the only solution that explained the intuition. Thank you so much!
@lindalee38793 жыл бұрын
I really love the thought process and explanation. Thanks a bunch! :)
@yadhunandhanr75904 жыл бұрын
This is the way to explain algorithms, great work!!!
@kunzhou51593 жыл бұрын
The ONLY way.
@AmitKumar-sj9gr3 жыл бұрын
Kudos Boss, tried 2-3 videos to understand, but this video finally made picture clear, Great work.
@amrutansumallick90723 жыл бұрын
i watched number of videos and read articles, ,but histogram problem i never could solve. I got the code too, but still i could not understand the inner while! Finally I have a grasp over it.
@budsyremo2 жыл бұрын
Love your explanations. Very high quality and I encourage you to please release more of them .
@amitpurohit88164 жыл бұрын
Really really great explanation!!! Others only told the process but this explanation told why are we doing that process....especially I was not getting why are we pushing the elements int the stack....but now I got that actually we are tracking rectangles by doing so.....Thank you very much!!!
@sharkdeng92533 жыл бұрын
smart solution and clear explanation
@ghanalkaushik20584 жыл бұрын
By far the best solution on this topic. Thank you very much sir.
@l.k30723 жыл бұрын
This is awesome video. BF approach first, analysis, and drive improved solution from there.
@sarvamsundaram3 жыл бұрын
Thanks for this awesome video. what i liked most is correcting the algorithm on the go,while learning this is a good approach. Thanks once again. PS: i have used single stack with value and index.
@leontylahman54553 жыл бұрын
Great explanation! Thanks a lot.
@TheNobodyscat3 жыл бұрын
GREAT explanation. thank you.
@rafaelcavalcantechaves813 жыл бұрын
Great explanation, thanks
@jwang34173 жыл бұрын
7:47 good explaination!
@乾淨核能3 жыл бұрын
I love how you explain you train of thoughts and adjust you pseudo code accordingly. Thank you so much!
@pravinranjan3 жыл бұрын
Great Explanation.!! It would be great if you upload videos for more DS problems. Thank you
@HienNguyenTechIO4 жыл бұрын
Very good explanation
@ravikhinchi70672 жыл бұрын
thanks man, really helped !!
@pranjalyadav79173 жыл бұрын
This was a real good explanation.
@vlogwithdevesh99144 жыл бұрын
I think the brute force approach will fail when you have minimum height at the end because it 'j' will encounter minimum height every time and will calculate area with respect to that only!!
@iksarpek4 жыл бұрын
Great quality
@meht84 жыл бұрын
Awesome explanation!!!
@sophiayue24843 жыл бұрын
I enjoyed your video. You explained well. It is the best video regarding this topic. Where can I find the code? What is the link of Knapsak website? Thanks, Sophia
@dungeondj44184 жыл бұрын
Great video, thank you!
@emilyhuang27592 жыл бұрын
13:57 why do you push the current height, height[i] , when you are adding the shorter rectangle when height[i] is greater than hstack.peek()? Shouldn't that happen when heights[i] is LESS than hstack.peek()?
@subee12810 ай бұрын
Thanks
@emilyhuang27592 жыл бұрын
Would it be possible to push onto the stack before popping it off the rectangle? Would that help with being able to end the histogram with all rectangles popped off?
@abdurrezzakefe53084 жыл бұрын
Very clean explanation, keep it up!
@abdurrezzakefe53084 жыл бұрын
Also we can do it with just one stack.
@lawrencejustin81362 жыл бұрын
Forgive my ignorance but why is the width (j-i+ 1) in the brute force? I don't understand why we added 1 to it.
@AutusDeletus984 жыл бұрын
will this work if you input 1 2 3? It seems like it will never get into the while loop.
@harshwardhanpatil3613 жыл бұрын
What will be the time complexity.
@sharkdeng92533 жыл бұрын
Could you give a working code here. Since I still failed the test. Thanks!
@shubhamrawat78954 жыл бұрын
Damn too good!
@sohammalakar18994 жыл бұрын
Doesn't the brute force algorithm fail for {3 ,1} ?
@KnapsackLabs4 жыл бұрын
I think it would still work. On the first iteration i==j==0 so minheight would be 3 which would be our answer.
@sohammalakar18994 жыл бұрын
@@KnapsackLabs Yup, got it , thanks !
@trungnguyennguyentri19754 жыл бұрын
what if there are some rectangle with 0 height?
@Arunkumar-pg8kx3 жыл бұрын
Both the stacks will be empty and starts tracking rectangles from scratch