1373. Maximum Sum BST in Binary Tree
Previous1372. Longest ZigZag Path in a Binary TreeNext1374. Generate a String With Characters That Have Odd Counts
Last updated
Last updated
**Input:** root = [1,4,3,2,4,2,5,null,null,null,null,null,null,4,6]
**Output:** 20
**Explanation:** Maximum sum in a valid Binary search tree is obtained in root node with key equal to 3.**Input:** root = [4,3,null,1,2]
**Output:** 2
**Explanation:** Maximum sum in a valid Binary search tree is obtained in a single root node with key equal to 2.**Input:** root = [-4,-2,-5]
**Output:** 0
**Explanation:** All values are negatives. Return an empty BST.**Input:** root = [2,1,3]
**Output:** 6**Input:** root = [5,4,8,3,null,6,3]
**Output:** 7