@Test public void randomTest() { int N = 100000; Random r = new Random(); for (int i = 10; i < N; i += r.nextInt(i)) { TreeNode bt = TreeNode.buildBT(i); InorderWithConstantSpace.solve(bt); TreeNode bst = TreeNode.buildBST(i); Assert.assertEquals(false, IsBst.isBst(bt)); Assert.assertEquals(true, IsBst.isBst(bst)); } }
public static boolean isBst(TreeNode root) { return help(root, null, null); }
IsBst { public static boolean isBst(TreeNode root) { return help(root, null, null); } }
IsBst { public static boolean isBst(TreeNode root) { return help(root, null, null); }  }
IsBst { public static boolean isBst(TreeNode root) { return help(root, null, null); }  static boolean isBst(TreeNode root); }
IsBst { public static boolean isBst(TreeNode root) { return help(root, null, null); }  static boolean isBst(TreeNode root);  }