[TASK] Day 4 + performance improvements

This commit is contained in:
2023-12-04 23:34:23 +01:00
parent 9ebb5c851a
commit ead47e232e
16 changed files with 385 additions and 38 deletions

View File

@@ -3,16 +3,14 @@ use std::fmt::Display;
use num::Integer;
pub fn read_file(filename: &str) -> Vec<String> {
pub fn read_file(filename: &str) -> String {
let contents = fs::read_to_string(filename)
return fs::read_to_string(filename)
.expect("Couldn't read file!");
}
let mut res: Vec<String> = Vec::new();
contents.lines().for_each(|l| res.push(String::from(l)));
res
pub fn into_lines(input: String) -> Vec<String> {
return input.lines().map(|l| l.to_owned()).collect();
}