Commit 0062edd2 authored by Kai Brandes's avatar Kai Brandes

extract another method

parent 4096cb9d
......@@ -43,12 +43,15 @@ fn detect_loop_for(start: &Vec<u32>) -> (u32, u32) {
return (iteration, 0);
}
pub fn calc_day_6_a(input: String) -> u32 {
let current_state = input.split_whitespace()
fn as_numbers(input: &String) -> Vec<u32> {
input.split_whitespace()
.map(|a| a.parse::<u32>().unwrap())
.collect::<Vec<_>>();
.collect::<Vec<_>>()
}
return detect_loop_for(&current_state).0;
pub fn calc_day_6_a(input: String) -> u32 {
let input = as_numbers(&input);
return detect_loop_for(&input).0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment