| 19 | class Solution { |
| 20 | public: |
| 21 | bool help(TreeNode* root, int mi, int ma, bool llimit, bool rlimit) { |
| 22 | if (root == NULL) return true; |
| 23 | if (llimit and root->val <= mi or rlimit and root->val >= ma) return false; |
| 24 | return help(root->left, mi, min(ma, root->val), llimit, true) |
| 25 | and help(root->right, max(mi, root->val), ma, true, rlimit); |
| 26 | } |
| 27 | |
| 28 | bool isValidBST(TreeNode* root) { |
| 29 | int ma = ((unsigned int) ~0) >> 1; |
nothing calls this directly
no outgoing calls
no test coverage detected