FunctionRacerProblemsRace

Decompress a Pair List

BeginnerArraysPython, JavaScript, TypeScript, Java, C++

nums is a list of pairs written flat: [freq1, val1, freq2, val2, ...]. Each pair means "val repeated freq times".

Return the list you get by writing out all the pairs in order.

Example 1

nums [1,2,3,4]
returns [2,4,4,4]

One 2, then three 4s: [2, 4, 4, 4].

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Arrays problems