FIND DISTANCE IN BINARY TREE | LEETCODE 1740 | PYTHON GRAPH BFS SOLUTION
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
Amazing solution! Uniquely done
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
True, but not wrong just the longer process