Solved Balanced Tree Problem with DFS