@@ -0,0 +1,942 @@
+package leetcode;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Set;%0Aimport java.util.TreeSet;%0A%0A/**%0A * https://leetcode.com/problems/validate-binary-search-tree/%0A */%0Apublic class Problem98 %7B%0A    public static class TreeNode %7B%0A        int val;%0A        TreeNode left;%0A        TreeNode right;%0A%0A        TreeNode(int x) %7B%0A            val = x;%0A        %7D%0A    %7D%0A    %0A    public boolean isValidBST(TreeNode root) %7B%0A        List%3CInteger%3E values = new ArrayList%3C%3E();%0A        inOrder(root, values);%0A        Set%3CInteger%3E sortedValues = new TreeSet%3C%3E();%0A        for (int v : values) %7B%0A            sortedValues.add(v);%0A        %7D%0A        return values.equals(new ArrayList%3C%3E(sortedValues));%0A    %7D%0A    %0A    private void inOrder(TreeNode node, List%3CInteger%3E values) %7B%0A        if (node == null) %7B%0A            return;%0A        %7D%0A        inOrder(node.left, values);%0A        values.add(node.val);%0A        inOrder(node.right, values);%0A    %7D%0A%7D%0A

Solve problem 98