Ruby
def diamond(apex_size) shape_array = (1..apex_size).to_a + (1..apex_size -1).to_a.reverse shape_array.each { |num| puts diamond_row(apex_size, num) } end def diamond_row(apex_size, num) "#{" " * (apex_size - num)} #{"*" * ((num * 2 - 1))}" end
I didn’t follow the fine print so I’m not sure this totally fits the spec now that I’m reading more carefully.
I’ll be more careful tomorrow 😄
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Ruby
I didn’t follow the fine print so I’m not sure this totally fits the spec now that I’m reading more carefully.
I’ll be more careful tomorrow 😄