Skip to main content
  1. Posts/

Advent of Code Day #2

·1 min
Aoc
Table of Contents

In day 2 you were given a set of rules to be parsed first. The looked like this:

1-3 a: abcde
1-3 b: cdefg
2-9 c: ccccccccc

Each line contains two numbers, a character and a password

Part 1 #

In part 1 you have to check if the given character appears at least and at most times given by the numbers. Each password that matches this behavior is considered valid.

Part 2 #

In part 2 you need to check if the given character is on one of the two given positions indicated by the numbers.