5 ms·
I’m using sqlite this year. Hoping that there won’t be any computational geometry or trie problems. Kind of hoping for a graph problem solvable with recursive C
by lyxell 2y ago
I’m using sqlite this year. Hoping that there won’t be any computational geometry or trie problems. Kind of hoping for a graph problem solvable with recursive CTEs, that would be cool.
- Rendello 2y agoI've been doing a lot with SQL for the first time in my life, this is tempting. I posted some SQLite CTE dark magic the other day but I certainly didn't understand it. Edit: Someone else posted an "Advent of " list which included https://adventofsql.com/ https://adventofsql.com/, perhaps those problems will be a little more pedestrian for SQL.
- shawn_w 2y agoI've solved some days in past years with sqlite + enough awk to transform the input into something that can be imported into a table. It can be a fun challenge.
- lyxell 2y agoI’m allowing myself to convert the data to a csv and read it using ’.mode csv’. I realized when solving todays problem that SQLite’s json_each("[" || T.c1 || "]") Is useful for parsing comma separated rows into (row, col)-pairs as well.
- feike 2y agoAs every year, I try to solve it with 1 sql statement for every challenge, https://gitlab.com/feike/adventofcode/-/tree/master/2024 https://gitlab.com/feike/adventofcode/-/tree/master/2024, likely going to get stuck again around day 12/13 or so!
- lyxell 2y agoAwesome! Thanks for sharing. It feels good to have some company in this, I will follow your progress! I created a repo for my solutions here: https://github.com/lyxell/aoc2024-sqlite https://github.com/lyxell/aoc2024-sqlite Update: Wow. Reading your solutions was a real eye-opener for me. It never struck me that one can exploit the fact that unmaterialized CTE's will not be evaluated for rows that is not needed by another SELECT and one can use this the same way one uses laziness in Haskell. This is great stuff, thanks again for sharing!
- deleted 2y ago[deleted]