day6 part2 rev
This commit is contained in:
parent
5211c5dfe7
commit
0c4376d503
@ -6,10 +6,11 @@ fn main() {
|
|||||||
.map(|line| {
|
.map(|line| {
|
||||||
&line[line.find(':').unwrap() + 1..] // Drop "Time:" and "Distance:"
|
&line[line.find(':').unwrap() + 1..] // Drop "Time:" and "Distance:"
|
||||||
}).map(|line| {
|
}).map(|line| {
|
||||||
line.split_whitespace().flat_map(|s| s.chars()).collect::<String>() // Split the numbers into their own elements.
|
line.split_whitespace() // Split the numbers into their own elements
|
||||||
})
|
.flat_map(|s| s.chars()).collect::<String>() // Combine the strings into a single one
|
||||||
.map(|num| num.parse::<i64>().expect("Couldn't parse number")) // Parse numbers into i32
|
}).map(|num| {
|
||||||
.collect(); // collect into Vec
|
num.parse::<i64>().expect("Couldn't parse number") // Parse numbers into i32
|
||||||
|
}).collect(); // Collect into Vec
|
||||||
|
|
||||||
|
|
||||||
let time = input[0];
|
let time = input[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user