2024: Day 1: use new util.zig

This commit is contained in:
Andrew Scott 2024-12-04 00:03:08 -05:00
parent efc1516acc
commit 332eaae6ee
Signed by: a
GPG key ID: 7CD5A5977E4931C1

View file

@ -1,16 +1,13 @@
const std = @import("std");
const print = std.debug.print;
pub fn main() !void {
const file = try std.fs.cwd().openFile("day1.txt", .{});
defer file.close();
const util = @import("util.zig");
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer std.debug.assert(gpa.deinit() == .ok);
const allocator = gpa.allocator();
const stat = try file.stat();
const input = try file.reader().readAllAlloc(allocator, stat.size);
const input = try util.readAllInput(1, allocator);
defer allocator.free(input);
var l1 = std.ArrayList(i32).init(allocator);