2022-12-04 00:52:52 +01:00
|
|
|
# [Day 1](https://adventofcode.com/2022/day/1)
|
|
|
|
:gift:
|
2022-12-04 01:07:50 +01:00
|
|
|
|
2023-12-09 13:50:09 +01:00
|
|
|
Today's language: **Awk + Bash**
|
2022-12-04 01:07:50 +01:00
|
|
|
|
2023-12-09 13:46:15 +01:00
|
|
|
Lines of code: **2**
|
|
|
|
|
2023-12-09 13:56:16 +01:00
|
|
|
Execution time: **0,011 s**
|
2023-12-09 13:46:15 +01:00
|
|
|
|
2023-12-09 13:50:09 +01:00
|
|
|
<!-- one-liners -->
|
|
|
|
|
2022-12-04 01:09:10 +01:00
|
|
|
- Task 1: We use awk to find the maximum while we iterate through the file
|
2022-12-04 01:07:50 +01:00
|
|
|
- Task 2: We use awk again for summing the calories, then sort them and take the top 3 which we again sum up with awk
|
2022-12-03 01:02:55 +01:00
|
|
|
```shell
|
2022-12-03 01:33:29 +01:00
|
|
|
# Find the Elf carrying the most Calories. How many total Calories is that Elf carrying?
|
|
|
|
awk -f day1-1.awk input.txt
|
|
|
|
# Find the top three Elves carrying the most Calories. How many Calories are those Elves carrying in total?
|
|
|
|
./day1.2.sh
|
2022-12-03 01:02:55 +01:00
|
|
|
```
|