Magazino Interview Question

traverse tree with nodes and recursion