Skip to main content

Cool solution. I decided to aim towards code readability, but I assume on top of being short your solution has great performance.
@silwol
I went with short AND unreadable:

input.lines().map(|line| {
let elf = line.as_bytes()[0] - b'A';
let me = line.as_bytes()[2] - b'X';
(me + 1 + (4 + me - elf) % 3 * 3) as u64
}).sum()

😉

silwol reshared this.