mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-11 15:06:07 +00:00
upgrade zig codes to 0.11.0-dev.3379+629f0d23b (#563)
* upgrade zig codes to 0.11.0-dev.3379+629f0d23b * upgrade zig codes to 0.11.0-dev.3379+629f0d23b
This commit is contained in:
@@ -8,7 +8,7 @@ const inc = @import("include");
|
||||
// 线性查找(数组)
|
||||
fn linearSearchArray(comptime T: type, nums: std.ArrayList(T), target: T) T {
|
||||
// 遍历数组
|
||||
for (nums.items) |num, i| {
|
||||
for (nums.items, 0..) |num, i| {
|
||||
// 找到目标元素, 返回其索引
|
||||
if (num == target) {
|
||||
return @intCast(T, i);
|
||||
@@ -51,5 +51,4 @@ pub fn main() !void {
|
||||
try inc.PrintUtil.printLinkedList(i32, node);
|
||||
|
||||
_ = try std.io.getStdIn().reader().readByte();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user