8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3f2272a commit 82e194fCopy full SHA for 82e194f
C++/chapTree.tex
@@ -1447,15 +1447,15 @@ \subsubsection{分析}
1447
\subsubsection{代码}
1448
1449
\begin{Code}
1450
-// LeetCode, Validate Binary Search Tree
+// Validate Binary Search Tree
1451
// 时间复杂度O(n),空间复杂度O(\logn)
1452
class Solution {
1453
public:
1454
bool isValidBST(TreeNode* root) {
1455
- return isValidBST(root, INT_MIN, INT_MAX);
+ return isValidBST(root, LONG_MIN, LONG_MAX);
1456
}
1457
1458
- bool isValidBST(TreeNode* root, int lower, int upper) {
+ bool isValidBST(TreeNode* root, long long lower, long long upper) {
1459
if (root == nullptr) return true;
1460
1461
return root->val > lower && root->val < upper
0 commit comments