Hi, my take on day 10 followed the same idea as Mike, removing all paired
brackets (for brevity, I use the term bracket for any of (){}[]<>), noting
that corrupt lines have remaining closing brackets, while incomplete lines
have only remaining opening brackets. I managed to make this one tacit
agai
Neater!
Cheers,
Mike
On 31/12/2021 19:19, Raul Miller wrote:
That is a different approach.
I had avoided even thinking about that approach, because of speed
concerns. But, testing a simple implementation on the large aoc
"puzzle input", I see that this approach completes in less than 17
milli
That is a different approach.
I had avoided even thinking about that approach, because of speed
concerns. But, testing a simple implementation on the large aoc
"puzzle input", I see that this approach completes in less than 17
milliseconds, Plus it makes reasoning about the problem really simple.
Sorry - always forget something - bkts ???
bkts =: 4 2 $'()[]{}<>'
I hope the rest is self-contained, but apologies for the ungraceful
character non-alignment. I'd avoided graphic boxing characters and
had sent in fixed-width font where it mattered!
Mike
On 31/12/2021 15:58, 'Michael D
I _think_ I used a somewhat different approach. I'll only deal with
part 1 as
part 2 doesn't add much complexity.
This approach is simple - remove adjacent pairs of opening and closing
brackets of the same kind until there are none. The function is called
reduce:
I've added echo lines only f
https://adventofcode.com/2021/day/10
For day 10's puzzle, the first part was determining whether
collections of braces and brackets were properly formed. The
allowable pairs were '()', '[]', '{}', and '<>', and the sample data
looked like this:
sample=:{{)n
[({(<(())[]>[[{[]{<()<>>
[(()[<>])]({[