public static int maxDepth1(TreeNode root) {
        // write your code here
        List<TreeNode>p=new ArrayList<>();
        if (root!=null)
            p.add(root);
        int h=0;
        while (!p.isEmpty()) {
            ++h;
            List<TreeNode>c=new ArrayList<>();
            for (TreeNode t:p) {
                if (t.left!=null) {
                    c.add(t.left);
                }
                if (t.right!=null) {
                    c.add(t.right);
                }
            }
            p=c;
        }
        return h;
    }