this post was submitted on 03 Dec 2023
88 points (92.3% liked)

Advent Of Code

1199 readers
1 users here now

An unofficial home for the advent of code community on programming.dev! Other challenges are also welcome!

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.

Everybody Codes is another collection of programming puzzles with seasonal events.

EC 2025

AoC 2025

Solution Threads

M T W T F S S
1 2 3 4 5 6 7
8 9 10 11 12

Visualisations Megathread

Rules/Guidelines

Relevant Communities

Relevant Links

Credits

Icon base by Lorc under CC BY 3.0 with modifications to add a gradient

console.log('Hello World')

founded 2 years ago
MODERATORS
 

Thanks Homer.

you are viewing a single comment's thread
view the rest of the comments
[–] learningduck@programming.dev 4 points 2 years ago

I don't want to read the number string from both left to right and Ruth to left. So, I

  1. iterate through each row and read the number string from left to right
  2. Store each number along with its cell range. ie: 467 is 0-2.
  3. Then from each symbol, find out if the position of the symbol +/-1 falls into any range. If so then sum that number.