Skip to content

Commit ad95f0d

Browse files
authored
Update median-of-two-sorted-arrays.cpp
1 parent 9102bae commit ad95f0d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

C++/median-of-two-sorted-arrays.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class Solution_Generic {
7171
// left xxxxxxxooooooo right, find first xo or oo
7272
while (left <= right) {
7373
const auto mid = left + (right - left) / 2;
74-
if (match(arrays, mid, k)) {
74+
if (!match(arrays, mid, k)) {
7575
right = mid - 1;
7676
} else {
7777
left = mid + 1;
@@ -88,6 +88,6 @@ class Solution_Generic {
8888
array->cend());
8989
}
9090
}
91-
return res < target;
91+
return res >= target;
9292
}
9393
};

0 commit comments

Comments
 (0)