Solve the problem to check if two trees are the same, a 10-minute-to-code problem.