public static LeetCode538TreeNode ConvertGreaterBST(LeetCode538TreeNode root) { if (root != null) { ConvertGreaterBST(root.right); sum += root.val; root.val = sum; ConvertGreaterBST(root.left); } return(root); }
public LeetCode538TreeNode(int val = 0, LeetCode538TreeNode left = null, LeetCode538TreeNode right = null) { this.val = val; this.left = left; this.right = right; }