Indeed interview question

tree traversal and dynamic programming