Unable to load image

rDrama Advent of Code Day 3: Gondola Grid

Here's my awful brute-forced C++ solution. Probably could've been done better but hey it works.

https://i.rdrama.net/images/1701590264996321.webp

____

What did you think about today's problem?

14
Jump in the discussion.

No email address required.

tripleposting my comment....

First a hint: my input parser was broken because I forgot that a number could end at the end of the line

Here's my solution, the two functions left off are an ugly parser which spit out sets containing tuples (symbol, i, j) and (value, i, range[j]) and to_search(i,j) spits out adjacent squares (I did skip 0,0 but just 1-indexed instead of checking -ves, OP using max(x-1, 0. is kewl). If I was smarter I would've used a map/dict somehow, which would've made .contains() viable which might've been more performant, but having to search by symbol for p2 would negate that probably. On the bright side I'm learning to use iterators over loops which might help my ongoing transition to Rust programmer.

https://i.rdrama.net/images/17015920751163921.webp

Jump in the discussion.

No email address required.

First a hint: my input parser was broken because I forgot that a number could end at the end of the line

same. that was annoying as to figure out.

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.