Skip to content

Commit 3d805ac

Browse files
authored
Update minimum-absolute-difference-between-elements-with-constraint.cpp
1 parent 245fef4 commit 3d805ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

C++/minimum-absolute-difference-between-elements-with-constraint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Solution {
99
set<int> bst;
1010
for (int i = x; i < size(nums); ++i) {
1111
bst.emplace(nums[i - x]);
12-
const auto it = bst.upper_bound(nums[i]);
12+
const auto it = bst.lower_bound(nums[i]);
1313
if (it != begin(bst)) {
1414
result = min(result, nums[i] - *prev(it));
1515
}

0 commit comments

Comments
 (0)