package leetcode;

/**
 * https://leetcode.com/problems/maximum-binary-tree-ii/
 */
public class Problem998 {
    public static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    }

    public TreeNode insertIntoMaxTree(TreeNode root, int val) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem998 prob = new Problem998();
    }
}

@@ -343,24 +343,38 @@
     
-// TODO%0A
+if (root == null) %7B%0A  
         
 retu
@@ -373,16 +373,18 @@
     
+  
 return n
 ull;
@@ -383,107 +383,255 @@
 rn n
-ull;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem998 prob = new Problem998()
+ew TreeNode(val);%0A        %7D%0A        if (root.val %3C val) %7B%0A            TreeNode node  = new TreeNode(val);%0A            node.left = root;%0A            return node;%0A        %7D%0A        root.right = insertIntoMaxTree(root.right, val);%0A        return root
 ;%0A  

Solve problem 998