1
0
mirror of https://github.com/chylex/Advent-of-Code.git synced 2025-04-21 10:15:43 +02:00

Add 2017 - Day 1 - Part 2

This commit is contained in:
chylex 2022-12-04 15:54:05 +01:00
parent dff04944f6
commit 5bb9f0af43
Signed by: chylex
GPG Key ID: 4DE42C8F19A80548

View File

@ -16,4 +16,13 @@ SET result = (
)
WHERE part = 1;
UPDATE "01.output"
SET result = (
SELECT SUM(a.character::INTEGER) AS result
FROM "01.characters" a
INNER JOIN "01.characters" b ON a.index = (b.index + (SELECT (MAX(index) + 1) / 2 FROM "01.characters")) % (SELECT MAX(index) + 1 FROM "01.characters")
WHERE a.character = b.character
)
WHERE part = 2;
SELECT aoc_results('01')