From f9e29a23463f4dd21a079a9818d6912a9221a87b Mon Sep 17 00:00:00 2001 From: Samuel Owen Date: Sat, 23 Dec 2023 01:09:50 +0000 Subject: [PATCH] Add Part II to notes.md --- lib/day1/notes.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/day1/notes.md b/lib/day1/notes.md index 391c5ba..e0ff219 100644 --- a/lib/day1/notes.md +++ b/lib/day1/notes.md @@ -1,7 +1,15 @@ # Day 1 +Part I: + The challenge that we've been set is to somehow parse through the input file, line by line and find the first and last digits of each line. We then need to add all of the digits to the total to get the final answer. +Part II: + +Your calculation isn't quite right. It looks like some of the digits are actually spelled out with letters: one, two, three, four, five, six, seven, eight, and nine also count as valid "digits". + +Equipped with this new information, you now need to find the real first and last digit on each line. For example: + ## Possible Solution Use a loop to go through each line, pattern match 0-9 and put all of the digits into a list. We could then index the first (0th) and last (-1th) digits and add them to the total. We could then move onto the next line and repeat the process.