Skip to content

Commit c369895

Browse files
committed
Day 19 change result to usize to make it work on web correctly
1 parent d696730 commit c369895

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

aoc-solver/src/y2024/day19.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn parse(input: &str) -> Result<(Vec<String>, Vec<String>), AocError> {
1313
Ok((towels, designs))
1414
}
1515

16-
fn count_possible(towels: &[String], design: &str, cache: &mut HashMap<String, usize>) -> usize {
16+
fn count_possible(towels: &[String], design: &str, cache: &mut HashMap<String, u64>) -> u64 {
1717
if design.is_empty() {
1818
return 1;
1919
}
@@ -35,26 +35,26 @@ fn count_possible(towels: &[String], design: &str, cache: &mut HashMap<String, u
3535

3636
pub struct Day19;
3737
impl Solution for Day19 {
38-
type A = usize;
39-
type B = usize;
38+
type A = u64;
39+
type B = u64;
4040

4141
fn default_input(&self) -> &'static str {
4242
include_str!("../../../inputs/2024/day19.txt")
4343
}
4444

45-
fn part_1(&self, input: &str) -> Result<usize, AocError> {
45+
fn part_1(&self, input: &str) -> Result<u64, AocError> {
4646
let (towels, designs) = parse(input)?;
4747

4848
let mut cache = HashMap::new();
4949
let possible = designs
5050
.iter()
5151
.filter(|design| count_possible(&towels, design, &mut cache) > 0)
52-
.count();
52+
.count() as u64;
5353

5454
Ok(possible)
5555
}
5656

57-
fn part_2(&self, input: &str) -> Result<usize, AocError> {
57+
fn part_2(&self, input: &str) -> Result<u64, AocError> {
5858
let (towels, designs) = parse(input)?;
5959

6060
let mut cache = HashMap::new();

0 commit comments

Comments
 (0)