public static boolean isValidBST(TreeNode root) {//passed
        if (root == null) return true;
        ArrayList<Integer> A = new ArrayList<Integer>();
        traverse_inorder(root, A);
        for (int i = 0; i < A.size() - 1; ++i) {
            if (A.get(i) >= A.get(i+1)) return false;
        }
        return true;
    }