2022.12.06 12:35 AM
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.
Pull requests welcome, of course! (I’ll do my best to keep up, but can see this lasting well after the holiday season.)
2022.12.08 09:48 AM
Nice work @SJT, thanks very much for sharing!
2022.12.16 08:54 PM
Here's another method of solving aoc1:
(first;sum 3#desc@)@\:sum each where[null 0N,r] _ r:"J"$read0 `:aoc1.txt
Tel: +44 (0)28 3025 2242
Tel: +1 (212) 447 6700
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.