private int getHeight(TreeNode root) {
            if (root == null)
                return 0;
            else {
                return Math.max(getHeight(root.left), getHeight(root.right)) + 1;
            }
        }