WORD BREAK | PYTHON | LEETCODE # 139

Sdílet
Vložit
  • čas přidán 8. 03. 2022
  • In this video we are solving a popular Amazon and Facebook interview question: Word Break. This is an interesting question because it seems quite complex to implement but the solution makes a lot of sense if you intuitively try to work through it.
    We'll be solving it with a clean BFS solution that should hopefully make a ton of sense once you see how things are done.
  • Věda a technologie

Komentáře • 17

  • @landocodes
    @landocodes Před 5 měsíci +3

    Bro I love how honest you are!! It really really makes you stand out against all of the other CZcamsrs who provide leetcode solutions.
    Keep it up man I’m a fan 🙌🏾

    • @crackfaang
      @crackfaang  Před 5 měsíci +1

      Haha yea I like to keep it real, especially with the shit questions.

  • @hennessyypapi
    @hennessyypapi Před rokem +3

    thank you for everything. out of all the major youtubers, your explanations resonate the most with me.

  • @alabamatabasco3418
    @alabamatabasco3418 Před 5 měsíci +5

    "Dynamic programming is shit"... sirens in the background lmao

  • @harshithamaripally3776
    @harshithamaripally3776 Před 5 měsíci +2

    your explanations resonate the most with me.

    • @crackfaang
      @crackfaang  Před 5 měsíci

      Thanks for the kind words mate! Glad to have you with us on the channel :)

  • @eduardoignacioroblessosa6349

    that was a pretty intuitive solution, just beautiful

  • @galinabakman9901
    @galinabakman9901 Před rokem

    great solution

  • @fadsa342
    @fadsa342 Před 11 měsíci +1

    I used recursion with memoization to solve the problem but your solution is a lot easier to grasp if I'm being honest. Out of curiosity can BFS be applied to most problems that you'd normally use DP or recursion for? And do you have any resources for getting better at determining space/time complexity?

    • @crackfaang
      @crackfaang  Před 11 měsíci +1

      I generally stay away from anything DP because I find the concept total bullshit. I will when necessary use recursion + memoization to get around standard DP problems. I always look for the DFS/BFS solution where it exists because my brain can very easily understand and code those, whereas DP is too much of a mind-bend.
      In terms of getting better at time/space complexity analysis, it really comes down to repetition and understanding the basics of what operations are what which then stack on top of each other when applied in a larger algorithm

  • @akjenksgamer1266
    @akjenksgamer1266 Před rokem

    Thank you! I don't like dp either so i'm glad i found another solution

    • @crackfaang
      @crackfaang  Před rokem +2

      Haha yea I try to avoid DP at all costs. It’s such a stupid and horrendous way of solving these problems

  • @samvaidya1987
    @samvaidya1987 Před rokem

    @4:21 - why do you think we have to process "leet" again?

    • @lonen3rd
      @lonen3rd Před 8 měsíci

      Because a word can exist multiple times in s e.g. s = "applepenapple"

  • @abbyh2879
    @abbyh2879 Před 2 lety

    It works but I am not sure why BFS?

    • @crackfaang
      @crackfaang  Před 2 lety +6

      Well if you can do the brute force solution but you aren't getting the job. So it's now a choice between DFS, BFS, and dynamic programming. I personally fucking hate DP and don't code any solutions in that garbage lol. And I think any time you have a choice between BFS and DFS I would choose BFS because you don't have to worry about recursion and stack overflow. And a lot of the times if you code up the recursive solution they ask for the iterative afterwards. It's up to you what way works best for you. I just went with BFS because it's my preferred solution and the one I can explain the best :)

    • @abbyh2879
      @abbyh2879 Před 2 lety

      @@crackfaang Thanks for the reply, makes sense. I hate DP too, that's the reason I am subscribed to your channel, because I can always find non-DP solutions here.