Indeed Interview Question

tree traversal and dynamic programming