AdventOfCode2022/3
matthias@arch c079e80137 day 4
2022-12-05 14:24:14 +01:00
..
.gitignore day 3 2022-12-04 00:52:52 +01:00
day3-1.vim day 4 2022-12-05 14:24:14 +01:00
main.c day 3 2022-12-04 00:52:52 +01:00
README.md day 4 2022-12-05 14:24:14 +01:00
rucksack_items.txt day 3 2022-12-04 00:52:52 +01:00

Day 3

🎁🎁🎁

Today's language: C

Extra: Task 1 in vimscript, generated by OpenAI with just a few fixes by myself

All the characters (the Elf's items) occuring in (half) a line (backpack) are stored as bits in an unsigned long, duplicate characters can then be determined by bitwise and-ing these numbers.

# Find the item type that appears in both compartments of each rucksack. What is the sum of the priorities of those item types?
gcc main.c -o day3
./day3

# OpenAI vim script
vim rucksack_items.txt
# in vim:
# :source day3-1.vim