Even parens

This commit is contained in:
Daniel Flanagan 2022-12-04 01:44:27 -06:00
parent 8dbd0cf9af
commit 1fc8a7f4fe
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4

View file

@ -10,7 +10,7 @@ fn processed_input(input: &str) -> Vec<Vec<i32>> {
fn both_parts(input: &Vec<Vec<i32>>) -> (usize, usize) {
input.iter().fold((0, 0), |(a, b), n| {
(
(a + ((n[0] <= n[2] && n[1] >= n[3]) || (n[2] <= n[0] && n[3] >= n[1])) as usize),
a + (((n[0] <= n[2] && n[1] >= n[3]) || (n[2] <= n[0] && n[3] >= n[1])) as usize),
b + ((n[0] <= n[3] && n[2] <= n[1]) as usize),
)
})