0
Leetcode Problem 1313. Decompress Run-Length Encoded List
1313. Decompress Run-Length Encoded List
AI Mock Interview
Leetcode Solutions
Iterative Decompression
Solution Idea
Algorithm Steps
Code Implementation
Complexity Analysis
Initialize an empty list
result
to store the decompressed elements.
Iterate over the input list
nums
with a step of 2.
For each iteration, take the current element as
freq
and the next element as
val
.
Create a sublist containing
val
repeated
freq
times.
Append the sublist to the
result
list.
Return the
result
list after the loop ends.
Preallocate and Fill
Ask Question
Programming Language
Purpose:
General Question
Debug My Code
image/screenshot of info
(optional)
[+]
Full Screen
Loading...
Get Answer
Suggested Answer
Answer
Full Screen
Copy Answer Code
Loading...