This commit is contained in:
krahets
2023-07-11 01:02:48 +08:00
parent b1544c92ca
commit cd145751e2
9 changed files with 449 additions and 48 deletions

View File

@@ -271,7 +271,7 @@ comments: true
} else if (nums.items[m] > target) { // 此情况说明 target 在区间 [i, m-1] 中
j = m - 1;
} else { // 找到目标元素,返回其索引
return @intCast(T, m);
return @intCast(m);
}
}
// 未找到目标元素,返回 -1
@@ -538,7 +538,7 @@ comments: true
} else if (nums.items[m] > target) { // 此情况说明 target 在区间 [i, m) 中
j = m;
} else { // 找到目标元素,返回其索引
return @intCast(T, m);
return @intCast(m);
}
}
// 未找到目标元素,返回 -1