FIND DISTANCE IN BINARY TREE | LEETCODE 1740 | PYTHON GRAPH BFS SOLUTION

Sdílet
Vložit
  • čas přidán 24. 07. 2024
  • Channel Discord Community: / discord
    Problem Link: leetcode.com/problems/find-di...
    Today we are solving my favorite type of question: Binary Trees where you need to transform them to a graph and traverse. It's Leetcode 1740: Find Distance in Binary Tree.
    TIMESTAMPS
    00:00 Intro
    00:08 Question Prompt
    00:21 Basic Example
    01:00 Two Possible Solutions Discussion
    04:46 Coding
    10:05 Time/Space Complexity
    11:00 Outro
  • Věda a technologie

Komentáře • 3

  • @yashgangrade6269
    @yashgangrade6269 Před 4 měsíci

    Amazing solution! Uniquely done

  • @DrAhdol
    @DrAhdol Před 3 měsíci

    Your example for two pass is slightly wrong, instead of starting back at the root you start from p and find q, then you're only going the remainder of the nodes

    • @jugsma6676
      @jugsma6676 Před 2 měsíci

      True, but not wrong just the longer process