This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| fn part(buffer: []const u8, init_rotations: f64, reverse: bool) !void { | |
| if (reverse) { | |
| var number_iter = std.mem.splitBackwardsScalar(u8, buffer, '\n'); | |
| var previous_gear = try std.fmt.parseFloat(f64, number_iter.next().?); | |
| var total_rotations: f64 = init_rotations; | |
| while (number_iter.next()) |number| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| const buffer1 = ""; | |
| const buffer2 = ""; | |
| const buffer3 = ""; | |
| fn part1(buffer: []const u8) [3]u16 { | |
| var mentors: [3]u16 = .{ 0, 0, 0 }; | |
| var pairs: [3]u16 = .{ 0, 0, 0 }; | |
| for (0..buffer.len) |index| { | |
| switch (buffer[index]) { | |
| 'A' => mentors[0] += 1, |
OlderNewer