Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree
Walk the tree from the root, matching each level against the array, and accept only a path that ends at a leaf exactly when the array ends.
Walk the tree from the root, matching each level against the array, and accept only a path that ends at a leaf exactly when the array ends.