this post was submitted on 01 Dec 2023
8 points (100.0% liked)

Advent of Code

285 readers
1 users here now

Advent of Code is an annual Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

https://adventofcode.com

founded 1 year ago
MODERATORS
8
Day 1 solutions (adventofcode.com)
submitted 11 months ago* (last edited 11 months ago) by mykl to c/adventofcode
 

How was day one for everyone? I was surprised at how tricky it was to get the right answer for part two. Not the usual easy start I've seen in the past. I'd be interested to see any solutions here.

you are viewing a single comment's thread
view the rest of the comments
[–] mykl 4 points 11 months ago* (last edited 11 months ago)

It’s normally not so tricky on the first day, and the examples also normally do a much better job of guiding you away from wrong approaches so the increasing delay is intended to ensure you aren’t just spamming poorly tested answers.

The task in part two could be better written as “find the first occurrence of a digit in the string (either as a digit or as a word), and then separately find the last occurrence of a digit (either as a digit or as a word again) then compose these two digits”. Thinking of it like that should help you identify where your problem lies.