How to Solve ANY Dynamic Programming Problem

Поділитися
Вставка
  • Опубліковано 15 гру 2024

КОМЕНТАРІ • 37

  • @MrTronich
    @MrTronich 3 роки тому +2

    Dude, you're the best. Articulate and logical. Can't ask for a better explanation.

  • @vikasbhat9339
    @vikasbhat9339 3 роки тому +6

    Hey Aleks! Your videos are awesome. Can you please make a video on a detailed explanation of recursion and backtracking

  • @mrboyban
    @mrboyban 3 роки тому +1

    Recently finished the first term of my first year CompSci course and got stung when the lecture introduced the recursion concept by jumping in straight to the rodCutting problem. Glad to hear DP is a hard concept to grasp as I still struggle to work that one out.
    A huge thanks for making this content available to us all. No all heroes wear capes! Cheers

    • @babybear-hq9yd
      @babybear-hq9yd  3 роки тому +1

      So happy to hear! Really happy that I could help :)

  • @MinhNguyen-lz1pg
    @MinhNguyen-lz1pg 2 роки тому

    what a great human being. You deserves more subscribers

  • @prasoonrajpoot4077
    @prasoonrajpoot4077 2 роки тому

    man the way and the speed you teach at just perfectly fits in with the way, I like someone to teach me and at the perfect speed, hoping to see more of your videos soon man.

    • @babybear-hq9yd
      @babybear-hq9yd  2 роки тому

      Appreciate it buddy glad it resonated!

    • @irynaspm284
      @irynaspm284 2 роки тому

      @@babybear-hq9yd please come back🙏🏼 you’re the best at explanations

  • @omerfarukbulut9295
    @omerfarukbulut9295 3 роки тому

    There are dozens of video on youtube but I learn best from you :)

  • @RelaxationVideos99
    @RelaxationVideos99 2 роки тому

    Hey Aleks! Where have you been man its been a year since your last upload.

  • @kwanghyunlim3489
    @kwanghyunlim3489 3 роки тому +1

    Awesome. I really like your videos. Thanks!

  • @emmanastase1277
    @emmanastase1277 2 роки тому

    Great video, extremely informative

    • @babybear-hq9yd
      @babybear-hq9yd  2 роки тому

      Thank you Emma, what a thoughtful comment. I appreciate your ongoing support over the years.

  • @darod6098
    @darod6098 3 роки тому

    Thanks so much, this is awesome!
    I would really be super grateful if you could do a video explaining Accounts Merge problem because there is not a single one good explanation on youtube and you're the best at this! Also consider opening a Patreon or something where we can give you at least some amount of money if someone wants to! :)

    • @babybear-hq9yd
      @babybear-hq9yd  3 роки тому +1

      thank you so much!!!!! but happy to provide for free, i don't want your guys' money :) I'll consider throwing a video up on it -- especially knowing nobody else has covered it well. In the meantime, I'll post my code below. I wrote it a while back, unaudited, so proceed with caution:
      class Solution(object):
      def accountsMerge(self, accounts):
      emailToName = {}
      emails = {}
      for acc in accounts:
      name = acc[0]
      for email in acc[1:]:
      if acc[1] not in emails:
      emails[acc[1]] = set()
      emails[acc[1]].add(email)
      if email not in emails:
      emails[email] = set()
      emails[email].add(acc[1])
      emailToName[email] = name
      seen = set()
      ans = []
      for email in emails:
      if email not in seen:
      seen.add(email)
      stack = [email]
      component = []
      while stack:
      node = stack.pop()
      component.append(node)
      for neighbour in emails[node]:
      if neighbour not in seen:
      seen.add(neighbour)
      stack.append(neighbour)
      ans.append([emailToName[email]] + sorted(component))
      return ans

  • @dongdongchen455
    @dongdongchen455 3 роки тому

    please keep updating

  • @kayehong3615
    @kayehong3615 Рік тому

    It's great. Your idea is more understandable and helpful than leetcode card for me. I'm lucky today to meet your video. Thank you so much.

  • @amorfati4559
    @amorfati4559 2 роки тому

    What do I do if I can't even understand how to implement the recursive solution first? I don't have any idea how you would start to solve the robot problem. All I ever get for an explanation of recursion is the basics like factorial or fibonacci sequence, but I do not know your logic for how to solve this unique paths problem, or even how you derived it.

    • @babybear-hq9yd
      @babybear-hq9yd  2 роки тому +1

      Hey Amor, first thought is more practice required on recursion problems. This one is ranked Medium -- I would suggest going through all Easy problems you can find with recursion. Building from basics is best. (For the record, when I started on Leetcode I couldn't even solve 2Sum, so there is hope for all of us if enough work is put in). Beyond that, productive struggle to a problem definitely caps out; there is a point at which you hit diminishing returns. There've been many problems (including a large % of the ones I've put up on my channel) where I had to struggle and then look at solution(s) to either complete or optimize my answer. Part of the learning process.

  • @TheUltimateSolitude
    @TheUltimateSolitude 2 роки тому

    If people looked like what their names were, you'd be
    "bro", because you look like a true bro, bro.

  • @vinceluu
    @vinceluu 3 роки тому

    Can you tackle 1335. Minimum Difficulty of a Job Schedule or 1235. Maximum Profit in Job Scheduling? Having a hard time wrapping my head around the dp

    • @babybear-hq9yd
      @babybear-hq9yd  3 роки тому +1

      Hey Vince, I’ve had this one requested a lot recently. I’ll try to get to it and see if I can slap something meaningful together for you guys

  • @hrishekessaraghueeti1258
    @hrishekessaraghueeti1258 3 роки тому

    Thanks for the effort

  • @pa0414
    @pa0414 3 роки тому

    Awesome video ,why are you not posting any videos for past few weeks 🤔

    • @babybear-hq9yd
      @babybear-hq9yd  3 роки тому

      got tied up in some personal things :) i'll jump back on it soon

    • @darioarielgonzalezleegstra1741
      @darioarielgonzalezleegstra1741 3 роки тому

      @@babybear-hq9yd I just subscribed to your channel after watching some explanations, hope to see new videos soon :) thanks for you work!

    • @babybear-hq9yd
      @babybear-hq9yd  3 роки тому

      @@darioarielgonzalezleegstra1741 ty ty! weclome to the club :)

  • @malikjavaid3029
    @malikjavaid3029 Рік тому

    goated video

  • @DoskarinMarlen
    @DoskarinMarlen 3 роки тому

    watchu up to dawg? been a while

    • @babybear-hq9yd
      @babybear-hq9yd  3 роки тому +2

      Eyooo! Shifted my focus into other endeavours but i do still plan on jumping back into this, hopefully in not too long. Really have a lot of fun making these!

  • @NitirajSinghRathore
    @NitirajSinghRathore Рік тому

    Just remove the ANY word from the title. Because this is all the theory etc and even the intuition is discussed everywhere, books, videos etc. But all that still does not help when trying to solve a difficult problem. So I was expecting that you will also introduce the intuition both for recursion and DP with more complex problems so that practice and thought process will help solve ANY problem. But you just discussed one problem and probably the most easiest one and call the video title as ANY. I can guarantee that just by watching this video even you will not be able to the next difficult problem where DP will "improve" the recursion. Ask yourself.