@@ 1,11 1,11 @@
const std = @import("std");
const input = @embedFile("input");
const mem = std.mem;
-const fmt = std.fmt;
-
const print = std.debug.print;
-fn run(a: *mem.Allocator) [2]usize {
+pub fn main() !void {
+ var gpa = std.heap.GeneralPurposeAllocator(.{}){};
+ const a = &gpa.allocator;
var strings = mem.split(input, "\n");
var ids = std.AutoHashMap(usize, bool).init(a);
var max: usize = 0;
@@ 19,15 19,6 @@ fn run(a: *mem.Allocator) [2]usize {
if (id > max) max = id;
}
var i = max;
- while (i > 0) : ( i -= 1 ) {
- _ = ids.get(i) orelse return .{max, i};
- }
- return .{0, 0};
+ while (i > 0) : (i -= 1) _ = ids.get(i) orelse break;
+ print("part 1: {}\npart 2: {}\n", .{max, i});
}
-
-pub fn main() !void {
- var gpa = std.heap.GeneralPurposeAllocator(.{}){};
- const a = &gpa.allocator;
- var p = run(a);
- print("part 1: {}\npart 2: {}\n", .{p[0], p[1]});
-}>
\ No newline at end of file