Advent of Code 2021

I did Day 3 in this time:

Year2021 - Day3

Step 1: 3969000
Step 2: 4267809
Day3 Time Taken: 161.628µs

It was oddly fun to optimize, I did the oxygen/co2 lookup without allocating anything, using a kind of quicksort to subdivide the regions of bits and ignoring the bits I didn’t care about until I had the final top and bottom sorted to single values and those were my co2 and oxygen values, was fun. ^.^

It’s on github with the rest of course:

One part I initially screwed up on was when I put println!("Step 2: {}", oxygen_rating & co2_rating); instead of println!("Step 2: {}", oxygen_rating * co2_rating);, lol…

1 Like