Expand description
§Laboratories
Examining the input shows that it consists of a triangular Christmas tree shape with both every second line and second space blank. Two splitters will never occur immediately next to each other. This structure speeds up and simplifies the solution, and we compute both parts together.
The key insight to part two is that we only need the total count of paths, not each separate path. This means that if 2 paths enter a tile from the left and another 2 from the right, then we can simply sum the paths to 4. A dynamic programming approach counts the total number of paths one row at a time.
When a beam hits a splitter, the count underneath the splitter will be zero, and the number of beams to either side is incremented by the count of the beams hitting the splitter.
Functions§
Type Aliases§
- Input 🔒