Run-length encoding codec

Write codeEasy20 minSnowflake and Databricks style

Your task

Implement run-length encoding for a columnar store. Given a list of integer values (a column), produce a compact encoding as a list of [value, count] pairs where consecutive equal values are collapsed into one run. Then, to prove the codec round-trips, DECODE that encoding back into the original list and return the decoded list. The function must return the decoded list (which should equal the input). Input length <= 10^5.

Examples

rle_roundtrip(values: list[int]) -> list[int]
Example 1
Inputrle_roundtrip([1, 1, 1, 2, 2, 3])
Output[1, 1, 1, 2, 2, 3]