Day 6 (Puzzle 2) - Tuning Trouble

Task changed from detecting a unique sequence of length 4 to a unique sequence of length 14.
Just had to change a single if-check from checking for uniqueness (and potentially returning the position) from 4 to 14.
main
Peery 2 years ago
parent d93acf1fa6
commit 177390320f

@ -41,8 +41,8 @@ fn find_starter_marker(transmission: &Vec<char>) -> u32 {
for i in 0..transmission.len() { for i in 0..transmission.len() {
last_seen.push_back(transmission[i]); last_seen.push_back(transmission[i]);
if last_seen.len() >= 4 { if last_seen.len() >= 14 {
println!("{:?} is unique: {}", last_seen, contains_unique_sequence(&last_seen)); //println!("{:?} is unique: {}", last_seen, contains_unique_sequence(&last_seen));
if contains_unique_sequence(&last_seen) { if contains_unique_sequence(&last_seen) {
return i as u32; return i as u32;
} }

Loading…
Cancel
Save