Advent of Code 2022 – Day 1

Eric Wastl’s annual Advent of Code competition draws some veteran q coders out of their hidey-holes each year. Their ingenious q solutions repay study, but are mostly shared in private forums. This year’s Day 1 AoC puzzle is not difficult, but it provoked solutions I would never have thought of myself.

Lucky you! I’ve scraped together the solutions I’ve seen and written them up in the Study Q repo, where you can also find the test and competition input files and solution scripts to play with. Just clone the repo, enjoy – and feel your q power growing.

https://github.com/qbists/studyq

Pull requests welcome, of course! (I’ll do my best to keep up, but can see this lasting well after the holiday season.)

Nice work @SJT, thanks very much for sharing! 

 

Here’s another method of solving aoc1:

(first;sum 3#desc@)@:sum each where[null 0N,r] _ r:“J”$read0 `:aoc1.txt