Expand description
Advent of Code 2022 Day 5: https://adventofcode.com/2022/day/5
The day five challenge mostly revolves around vector manipulation (my chosen methodology for managing the state of the crates). The most challenging part was to parse the input text into the initial state representation.
Once the input has been parsed part one has us move crates one at a time
from the top (end) of one stack onto another i.e., std::vec::Vec::pop
from one vector and then std::vec::Vec::push
onto another. The second
part requires maintaining the order of multiple crates as they are moved
from one stack to another, so we just move them one at a time into a
temporary vector, reverse the order of that and then play them back into
the destination vector.
Functions§
- The solution for the day five challenge.