Maximal square | Dynamic programming | Leetcode

Поделиться
HTML-код
  • Опубликовано: 23 окт 2024
  • Given an m x n binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.
    Example 1:
    Input: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]
    Output: 4
    Example 2:
    Input: matrix = [["0","1"],["1","0"]]
    Output: 1
    Example 3:
    Input: matrix = [["0"]]
    Output: 0
    Constraints:
    m == matrix.length
    n == matrix[i].length
    matrix[i][j] is '0' or '1'.

Комментарии • 31

  • @williamaldridge975
    @williamaldridge975 10 дней назад

    thank you! this explanation is far more clear than those i watched before

  • @thellaidhinesh8929
    @thellaidhinesh8929 5 месяцев назад +2

    i thought this was very complexed problem. after watching this video, i got the confidence to solve this problem. Thanks alisha!

  • @ankk98
    @ankk98 11 месяцев назад

    The intuition behind this algo is that we are checking for all possible squares ending at the given index.
    So, we are using the results of maximum sized squares ending at 3 adjacent indexes and using that information to find out the max possible solution at current index.

  • @manojtate9604
    @manojtate9604 8 месяцев назад

    Great clarification! 😃

  • @amanchaudhary8817
    @amanchaudhary8817 4 месяца назад

    excellent explanation mam.

  • @PAVITHRAR-x9c
    @PAVITHRAR-x9c 4 месяца назад

    I have a dought, you are returning the max area by 3* 3 but the right area is 2*3 right???

  • @Shivam-wl7fg
    @Shivam-wl7fg 9 месяцев назад

    Nice Explanation 😃

  • @pabitrakb5291
    @pabitrakb5291 7 месяцев назад

    Nice explanation 😊

  • @shivanshpareek7278
    @shivanshpareek7278 2 года назад +2

    please add the link as well and ur playlists are best way to revise and the way you explain gives me confidence to speak in interviews ..
    Thanks a lot for amazing content

  • @duck3072
    @duck3072 Год назад +2

    Can we solve problems by filling dp from last cell to first

  • @BereniceVirginis
    @BereniceVirginis 8 месяцев назад

    Space Complexity: O(1)
    int maxSquare(int n, int m, vector mat){
    // code here
    int ans=0;
    for(int i=0;i

  • @kpjVideo
    @kpjVideo 2 года назад

    Great explanation! This helped a bunch!

  • @Coding_Destini
    @Coding_Destini Год назад

    Thank you so much for this approach ... this is really easy

  • @govinth2462
    @govinth2462 10 месяцев назад

    I mam I want talk with your about my features opportunity where can connect with you

  • @prasannaprabhakar1323
    @prasannaprabhakar1323 2 года назад

    The way you are conveying the intuition part of the solution creates the difference.
    Nice choice of questions btw.

  • @raj_kundalia
    @raj_kundalia Год назад

    thank you!

  • @shivanshyadu4830
    @shivanshyadu4830 2 года назад +1

    Ufff didi one of the best place and you just explained the code in really easy way, I saw everyone's video but they just copy pasting the solution ❤❤😊

  • @willingtushar
    @willingtushar 2 года назад +1

    Nice explanation Indeed!

  • @vikashdhania2970
    @vikashdhania2970 2 года назад

    thanks mam

  • @AshishVerma-m4v
    @AshishVerma-m4v Год назад

    thankyou so much worth watching!!!!

  • @anupamojha3836
    @anupamojha3836 2 года назад

    very nice explaination

  • @shanidandanayak3806
    @shanidandanayak3806 6 месяцев назад

    Arigatho

  • @anshulbhati5752
    @anshulbhati5752 2 года назад

    greatt explanation!

  • @shouryagupta8763
    @shouryagupta8763 2 года назад

    thanks a lot didi!

  • @rudrakshsharma4601
    @rudrakshsharma4601 2 года назад

    nice work alisha

  • @tiger7858
    @tiger7858 Год назад +1

    inside if( i = = 0 || j = = 0) you are doing unnecessary work you can leave it as it is , nice explanation overall 🙏thank you