parent
68c7b41fc6
commit
7d36ddd8fe
@ -0,0 +1,19 @@
|
||||
use failure::*;
|
||||
|
||||
pub fn solve(input: &str) -> Result<String, Error> {
|
||||
Ok(
|
||||
input
|
||||
.trim()
|
||||
.split("\n")
|
||||
.map(|row| {
|
||||
let row: Vec<_> = row.split("\t")
|
||||
.map(|x| x.parse::<usize>().unwrap())
|
||||
.collect();
|
||||
let min = row.iter().min().unwrap();
|
||||
let max = row.iter().max().unwrap();
|
||||
max - min
|
||||
})
|
||||
.sum::<usize>()
|
||||
.to_string(),
|
||||
)
|
||||
}
|
Loading…
Reference in new issue