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!
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.
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.
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!
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()?
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.
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!!!
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.
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
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?
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!!
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!
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.
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.
I didn't thought the content would be that great. It turned out to be the best. Thanks for saving my day💜
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!
Damn. This question finally makes sense. I have been scrounging the internet to find a proper explanation for this question. Thank you kind sir!
Really great video.... please please upload more !!
This is the Best Explanation for the problem out there. Simply WoW!
smart solution and clear explanation
Omg thank you for this! None of the other vids i checked added any clarity.. but this definitely did! Your animations really helped
This is the way to explain algorithms, great work!!!
The ONLY way.
This is the only solution that explained the intuition. Thank you so much!
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
For anyone looking to get comfortable with mid-level algorithm problems, this is one of the best resources here.
Great explanation! Thanks a lot.
Love your explanations. Very high quality and I encourage you to please release more of them .
7:47 good explaination!
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()?
Great explanation, thanks
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.
I really love the thought process and explanation. Thanks a bunch! :)
GREAT explanation. thank you.
By far the best solution on this topic. Thank you very much sir.
This is awesome video. BF approach first, analysis, and drive improved solution from there.
Kudos Boss, tried 2-3 videos to understand, but this video finally made picture clear, Great work.
thanks man, really helped !!
Great Explanation.!! It would be great if you upload videos for more DS problems. Thank you
I love how you explain you train of thoughts and adjust you pseudo code accordingly. Thank you so much!
This was a real good explanation.
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!!!
Very good explanation
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.
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
Awesome explanation!!!
Great quality
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?
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!!
Great video, thank you!
Very clean explanation, keep it up!
Also we can do it with just one stack.
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.
What will be the time complexity.
Thanks
will this work if you input 1 2 3? It seems like it will never get into the while loop.
Could you give a working code here. Since I still failed the test. Thanks!
Doesn't the brute force algorithm fail for {3 ,1} ?
I think it would still work. On the first iteration i==j==0 so minheight would be 3 which would be our answer.
@@KnapsackLabs Yup, got it , thanks !
what if there are some rectangle with 0 height?
Both the stacks will be empty and starts tracking rectangles from scratch
@@Arunkumar-pg8kx ohhhhhh I see
Damn too good!
ye to sach hai ki bhagwan hai