Last active
December 6, 2022 15:11
-
-
Save timvisee/486914bf6fc6b30f113c1897c9896d59 to your computer and use it in GitHub Desktop.
AoC 2022 day06b extra p94
This file contains 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
[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" |
This file contains 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
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