Bloomberg interview question

One leetcode medium, tree traversal for spelling words