refactor: day 8

This commit is contained in:
YK 2024-12-08 22:03:40 +03:00
parent bb4e9bbbdd
commit 35c7749abf

View File

@ -16,13 +16,12 @@ fn _parse (data: &str) -> I {
let l = l.trim();
w = l.len();
for (i, c) in l.chars().enumerate() {
if c == '.' { continue; }
m.entry(c).or_default().push((h as isize, i as isize));
}
h += 1;
}
m.remove(&'.');
(m, w as isize, h as isize)
}
@ -48,7 +47,6 @@ fn _solve ((map, width, height): I, n: isize) -> O {
let new = [(b.0 + ydiff_mul, b.1 + xdiff_mul), (a.0 - ydiff_mul, a.1 - xdiff_mul)];
s.extend(new.into_iter().filter(is_valid));
}
}
};