Skip to content

Commit 99302ad

Browse files
committed
using DigitCounter trait
1 parent 2c2de67 commit 99302ad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/bin/07.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
advent_of_code::solution!(7);
22

3+
use advent_of_code::majcn::math::*;
34
use advent_of_code::maneatingape::parse::*;
45

56
fn parse_data(input: &str) -> Vec<Vec<u64>> {
@@ -29,7 +30,7 @@ fn solve(result: u64, left: u64, right: &[u64], use_concatenation: bool) -> bool
2930
}
3031

3132
if use_concatenation {
32-
let third_left_number = left * 10_u64.pow(right[0].ilog(10) + 1) + right[0];
33+
let third_left_number = left * 10_u64.pow(right[0].count_digits() as u32) + right[0];
3334
if solve(result, third_left_number, &right[1..], use_concatenation) {
3435
return true;
3536
}

0 commit comments

Comments
 (0)