Skip to content

Commit 820c8df

Browse files
committed
Day 7
1 parent fa76f11 commit 820c8df

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/bin/07.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use heapless::Vec as HeaplessVec;
2+
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
23
advent_of_code::solution!(7);
34

45
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -81,10 +82,13 @@ impl EquationData {
8182
}
8283

8384
fn solve(input: &str, ops: &[Op]) -> Option<u64> {
84-
let sum = input
85+
let lines: Vec<_> = input
8586
.lines()
8687
.filter(|l| !l.is_empty())
8788
.map(EquationData::parse)
89+
.collect();
90+
let sum = lines
91+
.par_iter()
8892
.filter(|eq| eq.has_valid_ops_combination(ops))
8993
.map(|eq| eq.test_value)
9094
.sum();

0 commit comments

Comments
 (0)