Code Room
CodingEasycod-g1045
Subject Storage encodingLevel Entry–Mid~20 minCommon in Storage & CDN interviewsIndustries Software development, Technology

Question

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.

Implement
rle_roundtrip(values: list[int]) → list[int]
Examples
in[[1,1,1,2,2,3]]out[1,1,1,2,2,3]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.