ALL NODES DISTANCE K IN BINARY TREE | PYTHON | LEETCODE # 863

Sdílet
Vložit
  • čas přidán 9. 03. 2022
  • In this video we are solving an interview question that is popular with Facebook, Amazon, and Microsoft: All Nodes Distance K in Binary Tree (LeetCode # 863).
    It's an interesting problem that can be solved in a clever way by transforming the given tree into a graph and then performing a BFS to reach the solution.
  • Věda a technologie

Komentáře • 28

  • @yuqian822
    @yuqian822 Před 6 měsíci +7

    My new life saver after NeetCode... Thanks!! very clear explanation.

    • @crackfaang
      @crackfaang  Před 6 měsíci +15

      Why not before NeetCode ;)

    • @yuqian822
      @yuqian822 Před 6 měsíci

      You got this ;)@@crackfaang

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

      @@crackfaang your content is good but let me give you some constructive feedback ( I mean no harm)
      Neetcode is more concise and to the point and also explains intuition better. Whereas you drag out sometimes and keep reiterating things that are already explained. This increases duration of video and hence lesser views.

  • @deepakgoyal1993
    @deepakgoyal1993 Před rokem +3

    Thank you so much for the explanation. I think you have made a mistake at 3:39 minute, actually you can reach node (1) from node (8); so adjacency list of 8 should be 8: [1]. Please correct me if I'm wrong. Thanks!

    • @crackfaang
      @crackfaang  Před rokem +1

      Yea I may have misspoke there. It’s okay the idea is still the same

  • @CreativeMining413
    @CreativeMining413 Před 9 měsíci

    Great video, understood everything.

  • @D_T244
    @D_T244 Před 2 lety +4

    Outstanding quality of the video and explanation. Well done and subbed!

    • @crackfaang
      @crackfaang  Před 2 lety

      Thanks for the kind words and for subscribing to my channel! It really helps me out

  • @scuderia6272
    @scuderia6272 Před měsícem

    Top content ser 👌🏻

  • @QVL75
    @QVL75 Před rokem +1

    Excellent description! Very clear to understand.

    • @crackfaang
      @crackfaang  Před rokem

      Thank you, glad you enjoyed the content

  • @maxli9629
    @maxli9629 Před rokem

    awesome!

  • @NirajKumar-dj3nz
    @NirajKumar-dj3nz Před rokem

    Hey!! A new Subscriber here😊

  • @user-ox9nf8bc5b
    @user-ox9nf8bc5b Před rokem

    thank you so much for the great explanation. i just have a one question: when you build the graph, is it a preorder or a BFS traversal?

  • @appcolab
    @appcolab Před 2 lety

    I like your explanation. Thanks for sharing,,, I foresee your channel growing very soon!!

    • @crackfaang
      @crackfaang  Před 2 lety

      Glad you found value in the video! Make sure to subscribe so you don’t miss future videos

    • @appcolab
      @appcolab Před 2 lety

      Alright subscribe! Thanks

  • @aadil4236
    @aadil4236 Před 2 lety +1

    Really good explanation. Do you have a git repo? Where I can find the solutions. It's really hard to see this in video every time, for a reference.

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

      Thanks for the kind words. I don’t currently have one but that’s a good recommendation. I will make one soon (currently on the beach enjoying some time off work 😊)

    • @aadil4236
      @aadil4236 Před 2 lety

      @@crackfaang on the beah? Wow, that must be fun. Where do you live If you don't mind me asking.
      My city is not located near the coast so it's really exciting for me to live near a beach.

    • @yogeshverma9267
      @yogeshverma9267 Před 23 dny

      @@crackfaangthank you for the great work❤ I don’t know if you have created a git repo or not, but i can suggest something I use. There’s a chrome extension LeetSync, it uploads your submitted code to github automatically, so you don’t need to do extra work

  • @appcolab
    @appcolab Před 2 lety

    Hey can you make the Leetcode "Find all people with a secret"? I was asked by Amazon but I couldn't come up with a nice solution during the interview

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

      I’ll add it to my queue of videos to make! Stay tuned

    • @appcolab
      @appcolab Před 2 lety

      Okay, thank you!! I can't wait

  • @saiavinashduddupudi8975
    @saiavinashduddupudi8975 Před rokem +1

    What is the overall Time Complexity?

    • @morenoh149
      @morenoh149 Před rokem

      building the graph is O(n), search is O(n) so both reduce to O(n)

    • @morenoh149
      @morenoh149 Před rokem

      He says time complexity at 14:00