Quantcast
Channel: Lojic Technologies Blog: Lojic Technologies Blog
Viewing all articles
Browse latest Browse all 84

Advent of Code 2022 - Day 3: Rucksack Reorganization

$
0
0
12
#lang iracket/lang#:requireracket(require"../advent.rkt"threading)

Day 3 - Part 1

Rucksack Reorganization

We’re given some sample input:

vJrwpWtwJgWrhcsFMMfFFhFp
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
PmmdzqPrVvPwwTWBwg
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
ttgJtRGJQctTZtZT
CrZsJsPPZsGzwwsLwLmpwMDw

The first half of each list contains items for one compartment of the backpack, and the second half contains items for the other compartment. Each backpack has, erroneously, one item in both compartments/halves.

Lower case items have priorities 1 to 26; upper case items 27 to 52.

Find the item type that appears in both compartments of each rucksack. What is the sum of the priorities of those item types?

More…

Viewing all articles
Browse latest Browse all 84

Trending Articles