Skip to content

Instantly share code, notes, and snippets.

@timvisee
Last active December 6, 2022 15:11
Show Gist options
  • Save timvisee/486914bf6fc6b30f113c1897c9896d59 to your computer and use it in GitHub Desktop.
Save timvisee/486914bf6fc6b30f113c1897c9896d59 to your computer and use it in GitHub Desktop.
AoC 2022 day06b extra p94
[package]
name = "day06b"
version = "0.1.0"
authors = ["Tim Visee <3a4fb3964f@sinenomine.email>"]
edition = "2021"
[profile.release]
codegen-units = 1
lto = true
strip = true
panic = "abort"
pub fn main() {
let d = include_bytes!("../input_extra.txt");
let mut w = 0;
'main: loop {
let mut seen = 0u128;
for i in (1..=94).rev() {
let mask = 1 << d[w + i];
if seen & mask == mask {
w += i;
continue 'main;
}
seen |= mask;
}
break;
}
println!("{}", w + 95);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment