Convert BST to Greater Tree
Here is a solution without defining helper function. :)
New to Java. what is the reason behind no return value at convertBST(root.right)? Is there something default returned and discarded?
good solutions! But you don't need to use the tmp to change sum
you could just do the follow
cur.val += sum;
sum = cur.val;
@fallcreek said in Java 6 lines:
You only need to visit every node once, like this
No one has replied
Really easy to understand!
Can you add some explanation??
Disabled Categories are greyed out
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.