Created
August 19, 2020 04:29
-
-
Save bparanj/a0b5decf4b9be6975aaff5a8a0a916bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @param {Integer[]} nums | |
# @return {Integer[]} | |
def decompress_rl_elist(nums) | |
result = [] | |
for index in (0..nums.size-2) do | |
item = nums[index] | |
if index.even? | |
item.times do | |
result << nums[index+1] | |
end | |
end | |
end | |
result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment