package leetcode;

/**
 * https://leetcode.com/problems/search-in-a-binary-search-tree/
 */
public class Problem700 {
    public static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

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

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

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

@@ -343,16 +343,32 @@
     
-// TODO%0A
+if (root == null) %7B%0A    
     
@@ -392,98 +392,331 @@
     
-%7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem700 prob = new Problem700()
+    %7D%0A        if (root.val == val) %7B%0A            return root;%0A        %7D%0A        TreeNode left = searchBST(root.left, val);%0A        TreeNode right = searchBST(root.right, val);%0A        if (left != null) %7B%0A            return left;%0A        %7D%0A        if (right != null) %7B%0A            return right;%0A        %7D%0A        return null
 ;%0A  

Solve problem 700