Expand description
§Transparent Origami
There are 2 possible approaches to tracking the position of dots after each fold:
- A
HashSet
that will collapse duplicate entries - An array of sufficient dimensions to track every possible coordinate.
We will use both approaches for speed, the first in part 1 and the second in part 2.
For part 2 we can determine the final size of the paper by taking the last x and y coordinates from the fold instructions. It’s then faster and more convenienent to process each point completely and update the final location, than to step through intermediate folds.
Structs§
Enums§
Functions§
- Fold point at
x
coordinate, doing nothing if the point is to the left of the fold line. - Fold point at
y
coordinate, doing nothing if the point is above the fold line. - Fold once then count dots. The sample data folds along
y
and my input folded alongx
testing both possibilities. - Decode secret message.