Skip to content

Instantly share code, notes, and snippets.

@bparanj
Created August 19, 2020 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bparanj/a0b5decf4b9be6975aaff5a8a0a916bb to your computer and use it in GitHub Desktop.
Save bparanj/a0b5decf4b9be6975aaff5a8a0a916bb to your computer and use it in GitHub Desktop.
# @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