Uber Interview Question

Graph traversal - BST traversal but required the optimal solution