Created
August 19, 2016 04:16
-
-
Save EdgarOrtegaRamirez/3c60b696d0e9a67a59c156a037cdbfd0 to your computer and use it in GitHub Desktop.
This file contains 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
def gen(nums, digit) | |
result = [] | |
nums.each_with_index do |num, i| | |
slice = nums[i, digit] | |
tmp = slice.concat(nums[i + digit]) | |
result.push(tmp) | |
end | |
result | |
end | |
gen([0,1,2],1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment