The Number of Beautiful Subsets leetcode || Dynamic Programming || Backtracking || Leetcode-2597

Поделиться
HTML-код
  • Опубликовано: 8 окт 2024

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

  • @ARYANMITTAL
    @ARYANMITTAL  Год назад +3

    Code & Notes: leetcode.com/problems/the-number-of-beautiful-subsets/solutions/3316187/image-explanation-both-o-nlogn-o-2-n-approaches-best-explanation-on-leetcode/

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

    Wonderful explanation , keep up the good work !

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

    keep up the good work

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

    cool dude..really a good explanation for a beginner like me..thnx

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

    nit: you do not need to sort vector v before you push items into the map mp2 (map is sorted anyway and this is why the code works)

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

    Oooooo Required a lot of patience , Nice one......!!!

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

    Can you please please make a video f question number of 1994 the number of good subsets , I am not getting the overall concept and nobody solves such tough questions on youtube except you!
    It would be of great help to all of us!!!
    Thanks!

  • @VarunSharma-xd8xd
    @VarunSharma-xd8xd 4 месяца назад +2

    watched 2 times but i dont know what u did in the dp approach

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

    I don't know why by map.find() wasn't working at all for me, whether I used set or map.

  • @satvrii
    @satvrii Год назад +12

    Striver 2.0

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

    why not use set in backtracking approach as we just care if nums[i]-k /nums[i]+k exists or not?

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

    Can you explain why prevNotTaken is inititalized with 1 and prevTaken with 0

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

      As initially we have empty subset

  • @GauravDuseja-t6q
    @GauravDuseja-t6q 4 месяца назад +1

    I was not able to implement backtracking proble what to do bhaiya

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

      Have you watched backtracking crash course bro?? 🫂

    • @Munchen888
      @Munchen888 2 месяца назад

      Look. You have two options: take or not take an element. If you not take you just go further -> func(idx + 1); else take you should make a check if such element in defaultdict (dict) or not . If not you place the element in defaultdict and go further. But when you return you should remove from dict. Set in initial state .

  • @kergeysarjakin5592
    @kergeysarjakin5592 4 месяца назад +1

    bro 1 and 4 itself can;t be taken bcoz 4-1=3 at 7:30

    • @ARYANMITTAL
      @ARYANMITTAL  4 месяца назад +1

      Yaa yaa yaa, true true bro

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

    your vives match with striver

  • @hasii36263
    @hasii36263 4 месяца назад +1

    man this is a very bad explanation.

  • @RohitKumar-cv7qb
    @RohitKumar-cv7qb Год назад +1

    way of teaching is good, but that extra effort we require to keep attention on English, that's really irritating

  • @prashantdubey9984
    @prashantdubey9984 Год назад +3

    Is it necessary to move your hands ?? It's really irritating

    • @tonytonychopper2485
      @tonytonychopper2485 Год назад +5

      "irritating" is a strong word. If you say "It would be less distracting if you reduce the hand movement", that might deliver what you wanted to say without hurting his feelings.

  • @ABHISHEKYADAV-lu5iz
    @ABHISHEKYADAV-lu5iz 3 месяца назад

    worst explanation ever.