Skip to content

Commit

Permalink
Revert formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Riari committed Dec 4, 2023
1 parent b5cd0ea commit 5e1018a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/bin/04.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ fn parse(input: &str) {

for (i, line) in input.lines().enumerate() {
let numbers = line.split(':').collect::<Vec<&str>>()[1].split(" | ").collect::<Vec<&str>>();
let winning = numbers[0]
.split_whitespace()
.map(|n| n.parse::<u32>().unwrap());
let have = numbers[1]
.split_whitespace()
.map(|n| n.parse::<u32>().unwrap());
let winning = numbers[0].split_whitespace().map(|n| n.parse::<u32>().unwrap());
let have = numbers[1] .split_whitespace().map(|n| n.parse::<u32>().unwrap());
let matching_count = winning.filter(|n| have.clone().any(|m| m == *n)).count() as u32;

// index => number of matching numbers, number of copies
Expand Down

0 comments on commit 5e1018a

Please sign in to comment.