Coding Interview Question | Max size square submatrix with all 1s | Dynamic Programming

  Рет қаралды 10,077

Keerti Purswani

Keerti Purswani

Күн бұрын

Пікірлер
@AR-scorp
@AR-scorp 4 жыл бұрын
I really like your Dynamic Programming series. Helped me understand the algos, and without looking at your code, I was able to write the code myself, even with space optimization by using two rows. Thanks for the videos.
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
That is awesome! 😇😇
@sarcastic5561
@sarcastic5561 8 ай бұрын
best the way u just make us understand by dry running the crux of the questions its all what we need for any questions thankyou !!
@rapakavineethkumar5429
@rapakavineethkumar5429 3 жыл бұрын
Excellent video, I solved this question before but never thought of this solution. I am watching all of your videos now.
@kannanparamasivam5331
@kannanparamasivam5331 4 жыл бұрын
Simple and clear explanation. Appreciate your effort!!!
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thank you 😊 😊
@55_jyotirmaykar30
@55_jyotirmaykar30 2 жыл бұрын
Excellent video ma'am. You are way more greater than I am capable of admiring.🙏🙏🙏🙏
@prashantgiri1285
@prashantgiri1285 3 жыл бұрын
Can I get a recursive approach?
@vibhu613
@vibhu613 3 жыл бұрын
great video ------tonnes of love didi
@AmanSingh-pq4rf
@AmanSingh-pq4rf 11 ай бұрын
Great explanation
@vigneshhendrix4447
@vigneshhendrix4447 4 жыл бұрын
You just Nailed it !🔥 I got the logic now. Thank yu !
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thank you 😊😊
@aniketpathak6623
@aniketpathak6623 4 жыл бұрын
Thanks for such clear explanation of the Algorithm. Please do continue this series of DP. 😊
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thanks Aniket. Going to continue this series for sure :)
@tejasghone5118
@tejasghone5118 4 жыл бұрын
Great explanation!! White board explanations really simplify things.
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thank you 😊😊
@shankar7662
@shankar7662 3 жыл бұрын
Nice Explanation!!
@KeertiPurswani
@KeertiPurswani 3 жыл бұрын
Thank you! 😇
@_YaelRobert
@_YaelRobert 4 жыл бұрын
Thanks Keerti for the good explanations! Your efforts to help us in understanding DP are highly appreciated! Thanks a lot :) Your videos are getting better than before. Keep it up!!
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thank you so much Yael :) means a lot!
@_YaelRobert
@_YaelRobert 4 жыл бұрын
@@KeertiPurswani Yup!!
@sanchitmehra1079
@sanchitmehra1079 3 жыл бұрын
Very nice explanation :)
@manojjain3501
@manojjain3501 3 жыл бұрын
I liked as you It mean a lot to you. :) . Excellent explanation.
@KurtVanBever
@KurtVanBever 3 жыл бұрын
Very nice presentation and explanation 👍
@KeertiPurswani
@KeertiPurswani 3 жыл бұрын
Thanks. Means a lot 😇😇
@laxman1225
@laxman1225 2 жыл бұрын
Thanks for the wonderful explanation. How to come up with these ideas other than practice?
@suvai_kitchen
@suvai_kitchen 3 жыл бұрын
Excellent video. at least i found a video who explains the intuition and logic of how solution works. Other videos just jump to solution and make us accept that. But what made you to think that the side of every square formed must be stored in another dp matrix? What brought you this thought?
@devprakash5320
@devprakash5320 3 жыл бұрын
Naice solution
@arnobchowdhury9641
@arnobchowdhury9641 4 жыл бұрын
Thanks a lot. Liked and Subscribed right when you said it means a lot to you.
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thank you so much. It does ❤️
@yawar110
@yawar110 3 жыл бұрын
what if we want to find the max sub metrics with all 0s instead?
@ashutoshjadhav
@ashutoshjadhav 4 жыл бұрын
Nicely explained ^_^
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thanks Ashutosh :)
@makeupby.ananya
@makeupby.ananya 3 жыл бұрын
How would we find which element of the dp table is our answer for the entire matrix? Like how would we get the answer as 3?
@ashpreetsinghanand7260
@ashpreetsinghanand7260 2 жыл бұрын
class Solution { public: int solve(vector &matrix, int i, int j, int &maxans, vector &dp){ if(i>=matrix.size() || j>=matrix[0].size()){ return 0; } if(dp[i][j]!=-1){ maxans = max(maxans, dp[i][j]*dp[i][j]); return dp[i][j]; } int diagonal = solve(matrix, i+1, j+1, maxans, dp); int right = solve(matrix, i, j+1, maxans, dp); int down = solve(matrix, i+1, j, maxans, dp); if(matrix[i][j]=='1'){ int ans = 1 + min(diagonal, min(right, down)); maxans = max(maxans, ans*ans); return dp[i][j] = ans; } else{ return dp[i][j] = 0; } } int maximalSquare(vector& matrix) { int a = matrix.size(); int b = matrix[0].size(); int maxans=0; vector dp(a+1, vector(b+1, -1)); solve(matrix, 0, 0, maxans, dp); return maxans; } };
@sukdebdasthakur6749
@sukdebdasthakur6749 4 жыл бұрын
On which CTC?
@sakshibhalothia8770
@sakshibhalothia8770 4 жыл бұрын
Can you pls tell me why you're taking minimum when we have to find maximum?
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Because all the 3 values should be 1 to form a square, even if one isn't, then it won't be square so you take minimum Please try to go through the video once more. This is exactly what I tried to explain 😅
@sakshibhalothia8770
@sakshibhalothia8770 4 жыл бұрын
@@KeertiPurswaniGot it!!!😅 Thank you so much
@ChristForAll-143
@ChristForAll-143 Жыл бұрын
Hope i would have a girl friend like you, very good explanation Thank you
@sukdebdasthakur6749
@sukdebdasthakur6749 4 жыл бұрын
On which company you are working? Please reply.
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Presently at Intuit. You can check on LinkedIn as well :)
@xendu-d9v
@xendu-d9v 16 күн бұрын
thanks
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 30 МЛН
DP 56. Count Square Submatrices with All Ones | DP on Rectangles 🔥
15:59
Maximal Square - Top Down Memoization - Leetcode 221
19:50
NeetCode
Рет қаралды 73 М.
Maximum Sum Rectangular Submatrix in Matrix dynamic programming/2D kadane
13:54
Tushar Roy - Coding Made Simple
Рет қаралды 205 М.
How I Mastered Data Structures and Algorithms in 8 Weeks
15:46
Aman Manazir
Рет қаралды 129 М.
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 30 МЛН