Skip to content

Instantly share code, notes, and snippets.

Created December 9, 2022 07:07
What would you like to do?
Given a 2d array of integers between 0-9. Check the path from each of the integers toward any edge of the array. Only straight paths needs to be considered, up, down, right, left. Count how many of the integers have lower integers on the path towards any edge.
Then multiply the count in each direction together up*down*left*right and assign store that count as a score for that integer.
Integers on the edge will always have a score of zero.
The input will be in this format and should be read from a file called sample.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment