Leetcode in Java && Oracle
420 subscribers
8 photos
397 files
400 links
Second channel: @codeforces_java

Let's Develop Together!
Download Telegram
image_2021-11-25_13-24-04.png
40.7 KB
#N897. Increasing Order Search Tree
problem link

#solution
class Solution {
TreeNode res = new TreeNode();
TreeNode curr=res;
public TreeNode increasingBST(TreeNode root) {
inOrder(root);
return res.right;
}

public void inOrder(TreeNode root){
if(root == null) return;
inOrder(root.left);
curr.right = new TreeNode(root.val);
curr = curr.right;
inOrder(root.right);
}
}