Step-By-Step Directions From a Binary Tree Node to Another
You are given the `root` of a binary tree with `n` nodes, each holding a unique value from `1` to `n`, plus two values `startValue` and `destValue` naming a start node `s` and a destination node `t`.
Return the shortest path from `s` to `t` as a string of the letters `L` (go to the left child), `R` (go to the right child) and `U` (go to the parent).
30:00
Step-By-Step Directions From a Binary Tree Node to Another
You are given the root of a binary tree with n nodes, each holding a unique value from 1 to n, plus two values startValue and destValue naming a start node s and a destination node t.
Return the shortest path from s to t as a string of the letters L (go to the left child), R (go to the right child) and U (go to the parent).
Go from 3 to 6. Plan: record the L/R path from the root to each node, drop the shared prefix (it leads to their lowest common ancestor), then climb with U and descend with the rest.