Tweak day 1 code structure
This commit is contained in:
parent
859699bcd0
commit
794cc70d60
|
@ -5,12 +5,13 @@ pub fn main() anyerror!void {
|
||||||
defer arena.deinit();
|
defer arena.deinit();
|
||||||
const alloc = &arena.allocator;
|
const alloc = &arena.allocator;
|
||||||
|
|
||||||
// Part 1
|
// Read our input
|
||||||
var f = try std.fs.cwd().openFile("input", .{});
|
var f = try std.fs.cwd().openFile("input", .{});
|
||||||
defer f.close();
|
defer f.close();
|
||||||
var contents = try f.readToEndAlloc(alloc, std.math.maxInt(u32));
|
var contents = try f.readToEndAlloc(alloc, std.math.maxInt(u32));
|
||||||
defer alloc.free(contents);
|
defer alloc.free(contents);
|
||||||
|
|
||||||
|
// Part 1
|
||||||
var depths = std.ArrayList(u32).init(alloc);
|
var depths = std.ArrayList(u32).init(alloc);
|
||||||
defer depths.deinit();
|
defer depths.deinit();
|
||||||
|
|
||||||
|
|
Reference in New Issue