Range Sum Query 2D | Leetcode

Поделиться
HTML-код
  • Опубликовано: 30 сен 2024
  • This video explains a very important programming interview problem based on 2d matrix which is finding range sum on a 2D matrix. If this problem was on 1D array then we could have applied prefix sum or segment tree if updates were allowed. In this case, we don't have updates, so 2D prefix sum array can be built to solve the problem. This will take order of number of rows or columns time depending on how we build prefix sum array. The best approach however just does preprocessing once and we can solve each query in O(1) constant time. I have explained all the approaches one by one to solve the problem along with intuition and examples.
    CODE LINK is present below as usual. 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 :)
    ======================================PLEASE DONATE=============================
    🧡 SUPPORT OUR WORK: / techdose
    💚 UPI-ID: surya.kahar@ybl
    💞JOIN Membership: / @techdose4u
    ==============================================================================
    INSTAGRAM : / surya.pratap.k
    LinkedIn: / surya-pratap-kahar-47b...
    WEBSITE: techdose.co.in/
    TELEGRAM Channel LINK: t.me/codewithT...
    TELEGRAM Group LINK: t.me/joinchat/...
    =======================================================================
    USEFUL LINKS:
    🟠Must do TIPS to ACE Virtual Interview: • 🔴Must do Tips to ACE y...
    🟢Best strategy to excel your coding interview: • 🔴Best strategy to exce...
    🟡Get your dream job in 1 month: • 🔴Get your dream job in...
    🔵How to crack dream job in just 2 months: • How to crack dream job...
    🟣7 Days DSA plan: techdose.co.in...
    RELATED LINKS:
    CODE LINK: gist.github.co...

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

  • @t-m5678
    @t-m5678 8 месяцев назад +1

    thank you. your explanation has increased my understanding. I was stumped on this for several days. Now I understand.👍

  • @JangBahadur3028
    @JangBahadur3028 2 года назад +4

    Lovely new logo

  • @SunilSahu-li4cy
    @SunilSahu-li4cy 2 года назад +1

    Could you please make a video on Leetcode 847....

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

    Optimum location of point to minimize total distance [OR] Rasta and Kheshtak in SEARCH AND SORT if you make on video plz, plz, plz,

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

    Could you please make video for Leetcode 2104?

  • @ashisranjandey7541
    @ashisranjandey7541 9 месяцев назад

    Great and correct explanation!!

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

    Thanks! great explanation

  • @Ashborn-g1r
    @Ashborn-g1r 5 месяцев назад

    God Level Logic

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

    Amazing explanation sir