A secret agent is attempting to gain access to a doorway using a PIN pad which is organised like this:
They observe somebody using the PIN pad on the doorway to gain access, but unfortunately couldn't get a good enough look at the exact keys which were pressed. The digits were approximately 97516, but each real digit could actually lie on a horizontally or vertically adjacent digit to the approximate ones. Your task is to use this information to determine a list of possible PIN codes.
It's also useful to note that some keys on the PIN pad appear to be more worn/used than others. The following array represents how worn each key looks, from most worn to least: [5,1,2,8,7,4,0,3,6,9]
Rewards:
- 4 points are awarded for determining all possible PIN codes for the example above
- 3 further points are awarded for completing the challenge in a unique choice of language amongst other participants
- 3 further points are awarded for ordering your list of possible PIN numbers by order of likelihood*, given the above ' wear' data
- As part of the Actions pipeline, tests will be performed.
- Once such test is for the PIN code
97516
, for which the result will be printed to stdout for verification. - Alternatively, run
go test
to run the tests locally.