current difficulties
- Day 21 - Keypad Conundrum: 01h01m23s
- Day 17 - Chronospatial Computer: 44m39s
- Day 15 - Warehouse Woes: 30m00s
- Day 12 - Garden Groups: 17m42s
- Day 20 - Race Condition: 15m58s
- Day 14 - Restroom Redoubt: 15m48s
- Day 09 - Disk Fragmenter: 14m05s
- Day 16 - Reindeer Maze: 13m47s
- Day 22 - Monkey Market: 12m15s
- Day 13 - Claw Contraption: 11m04s
- Day 06 - Guard Gallivant: 08m53s
- Day 08 - Resonant Collinearity: 07m12s
- Day 11 - Plutonian Pebbles: 06m24s
- Day 18 - RAM Run: 05m55s
- Day 04 - Ceres Search: 05m41s
- Day 23 - LAN Party: 05m07s
- Day 02 - Red Nosed Reports: 04m42s
- Day 10 - Hoof It: 04m14s
- Day 07 - Bridge Repair: 03m47s
- Day 05 - Print Queue: 03m43s
- Day 03 - Mull It Over: 03m22s
- Day 19 - Linen Layout: 03m16s
- Day 01 - Historian Hysteria: 02m31s
23!
Spoilerific
Got lucky on the max clique in part 2, my solution only works if there are at least 2 nodes in the clique, that only have the clique members as common neighbours.
Ended up reading wikipedia to lift one the Bron-Kerbosch methods:
#!/usr/bin/env jq -n -rR -f reduce ( inputs / "-" # Build connections dictionary # ) as [$a,$b] ({}; .[$a] += [$b] | .[$b] += [$a]) | . as $conn | # Allow Loose max clique check # if $ARGS.named.loose == true then # Only works if there is at least one pair in the max clique # # That only have the clique members in common. # [ # For pairs of connected nodes # ( $conn | keys[] ) as $a | $conn[$a][] as $b | select($a < $b) | # Get the list of nodes in common # [$a,$b] + ($conn[$a] - ($conn[$a]-$conn[$b])) | unique ] # From largest size find the first where all the nodes in common # # are interconnected -> all(connections ⋂ shared == shared) # | sort_by(-length) | first ( .[] | select( . as $cb | [ $cb[] as $c | ( [$c] + $conn[$c] | sort ) | ( . - ( . - $cb) ) | length ] | unique | length == 1 ) ) else # Do strict max clique check # # Example of loose failure: # 0-1 0-2 0-3 0-4 0-5 1-2 1-3 1-4 1-5 # 2-3 2-4 2-5 3-4 3-5 4-5 a-0 a-1 a-2 # a-3 b-2 b-3 b-4 b-5 c-0 c-1 c-4 c-5 def bron_kerbosch1($R; $P; $X; $cliques): if ($P|length) == 0 and ($X|length) == 0 then if ($R|length) > 2 then {cliques: ($cliques + [$R|sort])} end else reduce $P[] as $v ({$R,$P,$X,$cliques}; .cliques = bron_kerbosch1( .R - [$v] + [$v] ; # R ∪ {v} .P - (.P - $conn[$v]); # P ∩ neighbours(v) .X - (.X - $conn[$v]); # X ∩ neighbours(v) .cliques ) .cliques | .P = (.P - [$v]) | # P ∖ {v} .X = (.X - [$v] + [$v]) # X ∪ {v} ) end ; bron_kerbosch1([];$conn|keys;[];[]).cliques | max_by(length) end | join(",") # Output password
thanks
I’ve probably learned that term at some point, so thanks for naming it. That made me realise my algorithm was too thicc and could just be greedy.
23-2
Leaving something to run for 20-30 minutes expecting nothing and actually getting a valid and correct result: new positive feeling unlocked.
Now to find out how I was ideally supposed to solve it.
day 23
this is one of those days when it’s all about the right term to google right