Fix the issue of discusscomment 7938404 (#1006)

This commit is contained in:
易春风
2023-12-26 16:40:57 +08:00
committed by GitHub
parent 774c27c47e
commit 1ee0a7a7bf

View File

@@ -35,7 +35,7 @@ fn binary_search_lcro(nums: &[i32], target: i32) -> i32 {
if nums[m as usize] < target { // 此情况说明 target 在区间 [m+1, j) 中
i = m + 1;
} else if nums[m as usize] > target { // 此情况说明 target 在区间 [i, m) 中
j = m - 1;
j = m;
} else { // 找到目标元素,返回其索引
return m;
}