Step-By-Step Directions From a Binary Tree Node to Another
Examples
Example 1:
Input: root = [5,1,2,3,null,6,4], startValue = 3, destValue = 6
Output: "UURL"
Example 2:
Input: root = [2,1], startValue = 2, destValue = 1
Output: "L"
Example 1:
Input: root = [5,1,2,3,null,6,4], startValue = 3, destValue = 6
Output: "UURL"
Example 2:
Input: root = [2,1], startValue = 2, destValue = 1
Output: "L"
You are given the root of a binary tree with n nodes where each node has a unique value from 1 to n. You are also given integers startValue and destValue.
Return the shortest path from the node with value startValue to the node with value destValue as a string containing only:
'L': move to the left child'R': move to the right child'U': move to the parent2 <= n <= 10^51 <= Node.val <= nstartValue != destValuestartValue and destValue exist in the tree.