Transform a BST to greater sum tree
Given a BST, transform it into greater sum tree where each node contains sum of all nodes greater than that node.
自己想的复杂了,其实就是一个反向的inorder。新的值就是前面所有元素的求和。
Given a BST, transform it into greater sum tree where each node contains sum of all nodes greater than that node.
自己想的复杂了,其实就是一个反向的inorder。新的值就是前面所有元素的求和。