mirror of
https://github.com/RussellChamp/advent-of-code-2025-cursor.git
synced 2026-10-27 23:52:34 +00:00
Format code with cargo fmt
This commit is contained in:
1 parent
d3bc3493ee
commit
6f492ae3a1
3 files changed
+23
-6
No files matched your search
+9
-3
@@ -15,7 +15,7 @@ fn max_joltage_2(bank: &[u8]) -> u64 {
|
||||
let mut max = 0u64;
|
||||
for i in 0..n - 1 {
|
||||
let tens = bank[i] as u64;
|
||||
let units = suffix_max[i + 1] as u64; // O(1) lookup instead of O(n) scan
|
||||
let units = suffix_max[i + 1] as u64; // O(1) lookup instead of O(n) scan
|
||||
let joltage = tens * 10 + units;
|
||||
max = max.max(joltage);
|
||||
}
|
||||
@@ -33,7 +33,10 @@ pub fn part_one(input: &str) -> Option<u64> {
|
||||
}
|
||||
|
||||
// Convert line to digits
|
||||
let digits: Vec<u8> = line.chars().map(|c| c.to_digit(10).unwrap() as u8).collect();
|
||||
let digits: Vec<u8> = line
|
||||
.chars()
|
||||
.map(|c| c.to_digit(10).unwrap() as u8)
|
||||
.collect();
|
||||
total += max_joltage_2(&digits);
|
||||
}
|
||||
|
||||
@@ -77,7 +80,10 @@ pub fn part_two(input: &str) -> Option<u64> {
|
||||
continue;
|
||||
}
|
||||
|
||||
let digits: Vec<u8> = line.chars().map(|c| c.to_digit(10).unwrap() as u8).collect();
|
||||
let digits: Vec<u8> = line
|
||||
.chars()
|
||||
.map(|c| c.to_digit(10).unwrap() as u8)
|
||||
.collect();
|
||||
total += max_joltage_k(&digits, 12);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user