8000 Fixed isValidBST() · sanwan/leetcode-1@82e194f · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 82e194f

Browse files
committed
Fixed isValidBST()
1 parent 3f2272a commit 82e194f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

C++/chapTree.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,15 +1447,15 @@ \subsubsection{分析}
14471447
\subsubsection{代码}
14481448

14491449
\begin{Code}
1450-
// LeetCode, Validate Binary Search Tree
1450+
// Validate Binary Search Tree
14511451
// 时间复杂度O(n),空间复杂度O(\logn)
14521452
class Solution {
14531453
public:
14541454
bool isValidBST(TreeNode* root) {
1455-
return isValidBST(root, INT_MIN, INT_MAX);
1455+
return isValidBST(root, LONG_MIN, LONG_MAX);
14561456
}
14571457

1458-
bool isValidBST(TreeNode* root, int lower, int upper) {
1458+
bool isValidBST(TreeNode* root, long long lower, long long upper) {
14591459
if (root == nullptr) return true;
14601460

14611461
return root->val > lower && root->val < upper

0 commit comments

Comments
 (0)
0