Largest square formed in a Matrix | gfg potd | 10-07-24 | GFG Problem of the day

Поделиться
HTML-код
  • Опубликовано: 8 июл 2024
  • Geeks for Geeks Problem of the Day(POTD) in C++ | Largest square formed in a Matrix | Fully Explained🧠
    Solution Code :
    github.com/IshanSawhney/GfG_P...
    IMPORTANCE OF DSA FOR PLACEMENT:
    • Is DSA Still Important...
    BEST FREE WEB DEVELOPMENT COURSE:
    • Video
    🌐 Connect with Me:
    GitHub: github.com/IshanSawhney
    Linkedin: / ishansawhney
    #GFG #POTD #geeksforgeeks #problemoftheday #c++

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

  • @AdityaSomani-mr3vq
    @AdityaSomani-mr3vq 15 дней назад

    Thanks , but had one doubt that when you are updating the value of current position in dp will it be used? Cause we are going only right , diagonal and down , we are never going back to left or up for answers , I know something is wrong with my reasoning as the code got submitted but I had this doubt if you solve it please? I am saying as we are going top to bottom , when will be values of top be used as we need only values of bottom which are yet to be computed.

    • @CodeGenius316
      @CodeGenius316  15 дней назад +2

      The top-down approach with memoization ensures that all necessary values are computed in a depth-first manner and STORED for future use. This way, the function effectively calculates the size of the largest square submatrix, updating dp and maxi correctly.So, even though the values are updated in a top-down manner, the recursive exploration ensures that all dependent values are available when needed, resolving the concern you raised.

    • @AdityaSomani-mr3vq
      @AdityaSomani-mr3vq 15 дней назад

      @@CodeGenius316 Thanks for reply but I guess my DP concept is messed up , I need to learn it again from starting.😅