A very interesting problem. At first if you have no idea how to do it, it will be very difficult. Once you got it, you will find out that you only need to traverse the tree twice. First is travelling the tree with left-child
first, the other is right child first. If their outputs are the same, its symmetric tree. Mark: you need to add an tag to mark the value, to see if they are left child or right child.
import java.util.*;
public class Solution {
public class TreeNode {
int va......
阅读全文