Day 02 remove unnecessary cast
This commit is contained in:
parent
1801f30cd6
commit
a6d8472a21
1 changed files with 4 additions and 4 deletions
|
@ -33,11 +33,11 @@ fn is_safe(report: &Vec<i32>) -> bool {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn part_1(input: &Vec<Vec<i32>>) -> i32 {
|
fn part_1(input: &Vec<Vec<i32>>) -> usize {
|
||||||
input.iter().filter(|&report| is_safe(report)).count() as i32
|
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
|
input
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|report| {
|
.filter(|report| {
|
||||||
|
@ -45,7 +45,7 @@ fn part_2(input: &Vec<Vec<i32>>) -> i32 {
|
||||||
.map(|i| [&report[..i], &report[i + 1..]].concat())
|
.map(|i| [&report[..i], &report[i + 1..]].concat())
|
||||||
.any(|modified_report| is_safe(&modified_report))
|
.any(|modified_report| is_safe(&modified_report))
|
||||||
})
|
})
|
||||||
.count() as i32
|
.count()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Reference in a new issue