Maximal square | Dynamic programming | Leetcode #221

preview_player
Показать описание
This video explains a very important dynamic programming question which is the maximal square problem from leetcode #221. This has frequently been asked in interviews. In this problem, you are required to find the largest square formed by a binary matrix and the square should have all 1s in it. We need to return the area of the largest square matrix as our answer. This problem can be solved by depth first search, recursion and backtracking but they will consume a lot of time and so i have shown the intuitive approach to solve this problem by dynamic programming. I have shown the solution using proper examples to develop intuition for DP. CODE LINK is given below. If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)

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

"im not sure if you can understand this" and "I hope you are understanding this" haha, love these two quotes haha lol

quirkyquester
Автор

this is probably the best visual explanation i've seen thus far. This is really excellent, the ability to break it down with such simplicity. Subscribed.

pl
Автор

this was so simple, but finding a rectangle was so complicated, we literally converted that to a histogram for each row and calculated that. wish there was a simple dp like this for that problem.

amitavamozumder
Автор

Thank you this is the easiest explanation I've found so far on the internet for this problem.

ploratran
Автор

Man I dont how you get answers like this! Been doing the leetcode 30 day challenge with you. Love your way of thinking and understanding! Would love for you to do a video of when to use different approaches like backtracking, sliding window etc!

charlesbickham
Автор

Even beginners can understand DP, the way you explain is soo good.

SujeetKumar-hhjz
Автор

amazing explanation, thank you! I love how you walk us through your thought process and assume that we don't know what you are talking about.

quirkyquester
Автор

As always...the best explanation available on a lot surya...
TechDose, helping us learn DS and get jobs since 2019:)

ronitdhingra
Автор

So underrated but such a useful video with very clear explanation. I was able to solve a related problem after watching the video halfway. Thank you so much.

khan.mansoor
Автор

1st row and 1st column is not necessary in dynamic 2d array. We can take a 2d dp array of same size as input and fill it's 1st row and 1 column separately by the elements same as present in input array and then we can follow the same approach as mentioned in the video to fill other rows and columns.

rohitkumar
Автор

The way u explain with examples and all sorts of intutions, helps a lot to understand complex algorithms and codes. Yhank you so much

rishabhpathak
Автор

You've been a great help in my learning of DSA. Thank you.

mondayemmanuel
Автор

I was super confused how to solve the problem. You gave me a nice hint. Thanks.

kitkarson
Автор

If i get this in an interview I'm walking out...Great explanation though, 0% chance you could solve this without already knowing the solution or something similar in a 30 min interview. And i'm solid at DP

andrewcenteno
Автор

The Best Explanation of DP. Made it look so easy at the end !!

sumitanglekar
Автор

You are doing awesome job, i have refered other video where people just memorize and repeat, you understand and explain things. Very helpful. Keep doing the good work.

dragonindian
Автор

This channel deserves more subscription. You explained very well . Thanks a lot!

hanieharabzadeh
Автор

Your videos have been helping me out a lot. Just wanted to say thanks

bored_bread
Автор

I have seen your previous videos too, you are one of the best when it comes to explaining solutions!

parthshah
Автор

Marvelous solution! I love DP programming and your thought process. Thank you.

alperozdamar
join shbcf.ru