Skip to content

Commit e05c431

Browse files
committed
Update closest-binary-search-tree-value.cpp
1 parent 932d9e2 commit e05c431

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

C++/closest-binary-search-tree-value.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class Solution {
2121
gap = abs(root->val - target);
2222
closest = root->val;
2323
}
24-
if (root->val == target) {
24+
if (target == root->val) {
2525
break;
26-
} else if (root->val > target) {
26+
} else if (target < root->val) {
2727
root = root->left;
2828
} else {
2929
root = root->right;

0 commit comments

Comments
 (0)