Advent of Code 2022 Day 3 Solution: Rucksack Reorganization

It’s day 3 of Advent of Code, and I have two more solutions for you!

Ashley Peacock

--

Photo by Thomas Griesbeck on Unsplash

Spoilers ahead for day 3 of Advent of Code! If you don’t want to be given the answers, look away now!

It might be the weekend, but that doesn’t stop the coding challenges coming from Advent of Code! Today, as with all days, we get two more problems to find solutions for.

For anyone not familiar with Advent of Code, check out my day 1 article which explains what it is. For anyone else who just wants to plow on with day 3, it’s essentially an advent calendar for programmers that runs through December!

Time to tackle day 3!

Day 3 Problem: Reorganising Rucksacks

Similarly to prior days, I’m not going to go through the story aspect of the coding challenge. I will, however, give enough context so that the problem and solution makes sense.

For day 3’s problem, we will be given a list of strings containing a series of letters, both lowercase and uppercase. Here’s some example data:

vJrwpWtwJgWrhcsFMMfFFhFp
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
PmmdzqPrVvPwwTWBwg

--

--