[Rust/2023/12] Use array repeat instead of cycle
This commit is contained in:
parent
ef33f8ec23
commit
65b1925bb9
1 changed files with 3 additions and 9 deletions
|
@ -77,19 +77,13 @@ fn part2(input: &Input) -> usize {
|
|||
.par_iter()
|
||||
.map(|report| {
|
||||
count(&Report {
|
||||
springs: std::iter::once(&report.springs[..])
|
||||
.cycle()
|
||||
.take(5)
|
||||
springs: [&report.springs[..]; 5]
|
||||
.into_iter()
|
||||
.intersperse(&[Spring::Unknown])
|
||||
.flatten()
|
||||
.copied()
|
||||
.collect(),
|
||||
groups: std::iter::once(&report.groups)
|
||||
.cycle()
|
||||
.take(5)
|
||||
.flatten()
|
||||
.copied()
|
||||
.collect(),
|
||||
groups: [&report.groups; 5].into_iter().flatten().copied().collect(),
|
||||
})
|
||||
})
|
||||
.sum()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue