Run-Length Decode

Sometimes data is stored in a compressed form: first comes how many times to repeat a value, then the value itself. Given a list nums, each pair of elements represents a repeat count and the number to insert. Decode all pairs in order and return the resulting list.

Примеры

Ввод
[1, 2, 3, 4]
Вывод
[2, 4, 4, 4]
Ввод
[1, 1, 2, 3]
Вывод
[1, 3, 3]
Ввод
[0, 5, 2, 7]
Вывод
[7, 7]

Нужно реализовать

def decompress_rl_elist(nums: list[int]) -> list[int]:

Теги

array
PostgreSQLv16

Aquí aparecerá el resultado de la ejecución del código

Visible tests
1
Input
[1,2,3,4]
Expected[2,4,4,4]
2
Input
[1,1,2,3]
Expected[1,3,3]
3
Input
[0,5,2,7]
Expected[7,7]
4
Input
[3,9]
Expected[9,9,9]
5
Input
[1,0,1,0]
Expected[0,0]
6
Input
[0,0,0,0]
Expected[]
Focus radio
Paused · SomaFM · Fluid