MathWorks interview question

Leetcode 255. Validate a tree traversal