Skip to content

Instantly share code, notes, and snippets.

@venelrene
Created November 12, 2019 20:15
Show Gist options
  • Select an option

  • Save venelrene/6510d18873e626185a974f4df4597ee3 to your computer and use it in GitHub Desktop.

Select an option

Save venelrene/6510d18873e626185a974f4df4597ee3 to your computer and use it in GitHub Desktop.
Write a function that when given a number >= 0, returns an Array of ascending length subarrays.
def pyramid(numbers)
(1..numbers).collect { |n| [1]*n }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment