bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 1313. Decompress Run-Length Encoded List

1313. Decompress Run-Length Encoded List

Leetcode Solutions

Iterative Decompression

  1. Initialize an empty list result to store the decompressed elements.
  2. Iterate over the input list nums with a step of 2.
  3. For each iteration, take the current element as freq and the next element as val.
  4. Create a sublist containing val repeated freq times.
  5. Append the sublist to the result list.
  6. Return the result list after the loop ends.
UML Thumbnail

Preallocate and Fill

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...