/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } };*/ class Checker { bool helper(TreeNode* root, int min_val, int max_val) { if(!root) return true; if (root->val <= min_val || root->val >= max_val) return false; return helper(root->left, min_val, root->val) && helper(root->right, root->val, max_val); } public: bool checkBST(TreeNode* root) { // write code here return helper(root, INT_MIN, INT_MAX); } };