Advent of code day 1 in rust 

gitlab.com/MisterBiggs/aoc_202

```rust
fn part1(food_input: &str) -> usize {
food_input
.split("\n\n")
.collect::<Vec<&str>>()
.into_iter()
.map(|elf| {
elf.split_whitespace()
.map(|food| food.parse::<usize>().unwrap())
.sum()
})
.collect::<Vec<usize>>()
.into_iter()
.max()
.unwrap()
}
```

```rs
fn part2(food_input: &str) -> usize {
let mut elves_calories = food_input
.split("\n\n")
.collect::<Vec<&str>>()
.into_iter()
.map(|elf| {
elf.split_whitespace()
.map(|food| food.parse::<usize>().unwrap())
.sum()
})
.collect::<Vec<usize>>();

elves_calories.sort_by(|l, r| r.cmp(l));

elves_calories[..3].iter().sum::<usize>()
}
```

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.