leetcode - 1313 Decompress Run-Length Encoded List JavaScript Solution

Опубликовано: 17 Февраль 2026
на канале: litCode
447
8

simple js solution!
We are given a list nums of integers representing a list compressed with run-length encoding.

Consider each adjacent pair of elements [freq, val] = [nums[2*i], nums[2*i+1]] (with i (greater than or equal to) 0). For each such pair, there are freq elements with value val concatenated in a sublist. Concatenate all the sublists from left to right to generate the decompressed list.

Return the decompressed list.