| Conditions | 7 |
| Paths | 5 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | private static function helper(TreeNode $root = null, $min = null, $max = null): bool |
||
| 39 | { |
||
| 40 | if ($root === null) { |
||
| 41 | return true; |
||
| 42 | } |
||
| 43 | if ($min !== null && $min >= $root->val) { |
||
| 44 | return false; |
||
| 45 | } |
||
| 46 | if ($max !== null && $max <= $root->val) { |
||
| 47 | return false; |
||
| 48 | } |
||
| 49 | |||
| 50 | return self::helper($root->left, $min, $root->val) && |
||
| 51 | self::helper($root->right, $root->val, $max); |
||
| 52 | } |
||
| 54 |