Day 02 remove unnecessary cast

This commit is contained in:
Tobias Berger 2024-12-02 15:27:32 +01:00
parent 1801f30cd6
commit a6d8472a21
Signed by: toby
GPG key ID: 2D05EFAB764D6A88

View file

@ -33,11 +33,11 @@ fn is_safe(report: &Vec<i32>) -> bool {
})
}
fn part_1(input: &Vec<Vec<i32>>) -> i32 {
input.iter().filter(|&report| is_safe(report)).count() as i32
fn part_1(input: &Vec<Vec<i32>>) -> usize {
input.iter().filter(|&report| is_safe(report)).count()
}
fn part_2(input: &Vec<Vec<i32>>) -> i32 {
fn part_2(input: &Vec<Vec<i32>>) -> usize {
input
.iter()
.filter(|report| {
@ -45,7 +45,7 @@ fn part_2(input: &Vec<Vec<i32>>) -> i32 {
.map(|i| [&report[..i], &report[i + 1..]].concat())
.any(|modified_report| is_safe(&modified_report))
})
.count() as i32
.count()
}
#[cfg(test)]