Skip to content

Commit 2b46de3

Browse files
authored
Create decompress-run-length-encoded-list.py
1 parent 2a73b35 commit 2b46de3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Time: O(n)
2+
# Space: O(1)
3+
4+
class Solution(object):
5+
def decompressRLElist(self, nums):
6+
"""
7+
:type nums: List[int]
8+
:rtype: List[int]
9+
"""
10+
return [nums[i+1] for i in xrange(0, len(nums), 2) for _ in xrange(nums[i])]

0 commit comments

Comments
 (0)