Files
advent-of-code/2024/day-1/solution-2.sh

9 lines
207 B
Bash
Raw Normal View History

2024-12-03 10:14:09 +08:00
#!/usr/bin/env bash
join -1 2 -2 2 \
<( awk '{print $2}' input.txt | sort -n | uniq -c ) \
<( awk '{print $1}' input.txt | sort -n | uniq -c ) |
awk '{print $1 * $2 * $3 }' |
paste -s -d "+" |
bc