LeetCode solutions

1241. Decompress Run-Length Encoded List

My accepted Python solution to LeetCode problem 1241, Decompress Run-Length Encoded List, running in 0ms.

  • Difficulty: Easy
  • Python
  • Runtime 0ms
  • Memory 17.7MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 0ms, memory 17.7MB, accepted 2025-12-30.

python
class Solution:
    def decompressRLElist(self, nums: List[int]) -> List[int]:
        result = []
        for i in range(0, len(nums), 2):
            freq, val = nums[i], nums[i+1]
            result.extend([val] * freq)
        return result

Source