Fix the issue of discusscomment 7938404 (#1006)

pull/1007/head
易春风 11 months ago committed by GitHub
parent 774c27c47e
commit 1ee0a7a7bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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;
}

Loading…
Cancel
Save