Data update

This commit is contained in:
Ingy döt Net 2025-08-11 18:05:26 -07:00
parent 4d5544505c
commit 4924dd0264
3073 changed files with 55820 additions and 4408 deletions

View file

@ -0,0 +1,23 @@
create or replace function run_length_encode(str) as table
(WITH RECURSIVE cte AS (
SELECT
1 AS pos,
1 AS counter,
SUBSTRING(str, 1, 1) AS char,
SUBSTRING(str, 2, 1) AS nextc,
UNION ALL
SELECT
pos + 1 as pos,
CASE
WHEN nextc = char THEN counter + 1
ELSE 1
END as counter,
nextc as char,
SUBSTRING(str, 2 + pos, 1) as nextc
FROM cte
WHERE pos < LENGTH(str)
)
SELECT STRING_AGG( counter || char, '' ORDER BY pos) AS encoded_string
FROM cte
WHERE nextc != char
);

View file

@ -0,0 +1 @@
from run_length_encode('WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW');