Skip to content

Commit ba45291

Browse files
committed
feat(05/2025): solve second part for example, too slow for input
1 parent 5af9349 commit ba45291

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/solutions/year2025/day05.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@ impl Solution for Day05 {
1414
.to_string()
1515
}
1616

17-
fn part_two(&self, _input: &str) -> String {
18-
String::from("0")
17+
fn part_two(&self, input: &str) -> String {
18+
let (ranges, _) = self.parse(input);
19+
20+
ranges
21+
.iter()
22+
.flat_map(|range| range.clone())
23+
.unique()
24+
.count()
25+
.to_string()
1926
}
2027
}
2128

@@ -65,4 +72,9 @@ mod tests {
6572
fn part_one_example_test() {
6673
assert_eq!("3", Day05.part_one(EXAMPLE));
6774
}
75+
76+
#[test]
77+
fn part_two_example_test() {
78+
assert_eq!("14", Day05.part_two(EXAMPLE));
79+
}
6880
}

0 commit comments

Comments
 (0)