fn count_overlaps_in_row(row: usize, width: usize, claims: &[Claim]) -> usize {
    let mut claim_counts = vec![0; width];
    let claims_in_row = claims
        .iter()
        .filter(|claim| claim.y <= row && claim.y + claim.height > row);

    for claim in claims_in_row {
        claim_counts
            .iter_mut()
            .skip(claim.x)
            .take(claim.width)
            .for_each(|count| {
                *count += 1;
            });
    }

    claim_counts.iter().filter(|&&c| c > 1).count()
}
/// Finds the number of squares in a given row that fall within two or more claims.
Finds the number of squares in a given row that fall within two or more claims.
Finds the number of squares in a given row that fall within two or more claims .
fn count_overlaps_in_row(row: usize, width: usize, claims: &[Claim]) -> usize {
    let mut claim_counts = vec![0; width];
    let claims_in_row = claims
        .iter()
        .filter(|claim| claim.y <= row && claim.y + claim.height > row);
    for claim in claims_in_row {
        claim_counts
            .iter_mut()
            .skip(claim.x)
            .take(claim.width)
            .for_each(|count| {
                *count += 1;
            });
    }
    claim_counts.iter().filter(|&&c| c > 1).count()
}
fn count_overlaps_in_row ( row : usize , width : usize , claims : & [ Claim ] ) -> usize { let mut claim_counts = vec ! [ 0 width ] ; let claims_in_row = claims . iter ( ) . filter ( | claim | claim . y <= row && claim . y + claim . height > row ) ; for claim in claims_in_row { claim_counts . iter_mut ( ) . skip ( claim . x ) . take ( claim . width ) . for_each ( | count | { * count += 1 ; } ) ; } claim_counts . iter ( ) . filter ( | & & c | c > 1 ) . count ( ) }
Finds the number of squares in a given row that fall within two or more claims.
Finds the number of squares in a given row that fall within two or more claims .
row
usize
width
usize
claims
&[Claim]
row
usize
width
usize
claims
&[Claim]