<commit_before><commit_msg>isValidBST<commit_after>/**
 * http://leetcode.com/onlinejudge#question_98
 * 
 */
public class IsValidBST {
	public boolean isValidBST(TreeNode root) {
		return isValidBST(root, Integer.MIN_VALUE, Integer.MAX_VALUE);
	}

	private boolean isValidBST(TreeNode root, int min, int max) {
		if (root == null) {
			return true;
		}
		if (root.val > max || root.val < min) {
			return false;
		}
		boolean left = true;
		boolean right = true;
		if (root.left != null) {
			left = isValidBST(root.left, min, root.val - 1);
		}
		if (root.right != null) {
			right = isValidBST(root.right, root.val + 1, max);
		}
		return left && right;
	}
}

{'fraction_non_alphanumeric': 0.14350453172205438, 'fraction_numerical': 0.006042296072507553, 'mean_word_length': 3.390728476821192, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4469904', 'n_tokens_mistral': 271, 'n_tokens_neox': 245, 'n_words': 58}