public static boolean validBST(int[] values) {
		//if less than two elements in the array.
		//its always valid
		if (values.length < 2) return true;
		
		int i = 0;
		
		//find the beginnig of right sub tree 
		for (; i < values.length  && values[i] < values[values.length - 1]; i++);
		
		//now valid right subtreee
		for (int j = i; j < values.length - 1; j++) {
			if (values[j] < values[values.length - 1])
				return false;
		}
		
		return validBST(Arrays.copyOfRange(values, 0, i))
				&& validBST(Arrays.copyOfRange(values, i, values.length - 1));
	}