private static int depth(LeetCode543TreeNode root)
        {
            if (root == null)
            {
                return(0);
            }

            var L = depth(root.left);
            var R = depth(root.right);

            ans = Math.Max(ans, L + R + 1);
            return(Math.Max(L, R) + 1);
        }
 public LeetCode543TreeNode(int val = 0, LeetCode543TreeNode left = null, LeetCode543TreeNode right = null)
 {
     this.val   = val;
     this.left  = left;
     this.right = right;
 }
 public static int DiameterOfBinaryTree(LeetCode543TreeNode root)
 {
     ans = 1;
     depth(root);
     return(ans - 1);
 }