Pergunta de entrevista da empresa Uber

Graph traversal - BST traversal but required the optimal solution