Leetcode 1241 Solution
This article provides solution to leetcode question 1241 (decompress-run-length-encoded-list)
Access this page by simply typing in "lcs 1241" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/decompress-run-length-encoded-list
Solution
class Solution:
def decompressRLElist(self, nums: List[int]) -> List[int]:
ans = []
i = 0
while i < len(nums):
freq = nums[i]
val = nums[i + 1]
ans += [val] * freq
i += 2
return ans