Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 1
    \$\begingroup\$ I like the recursive way, intuitive but still short. As for easy challenges, I try to intermix them among more medium-difficulty challenges because those tend to be more interesting. but I always have a few of these laying around if I run out of ideas :P \$\endgroup\$ Commented Jul 3 at 11:14
  • \$\begingroup\$ @Dingus thanks for your suggestion! Considering the output, I would rather stick to the output type I have already chosen, as a list. \$\endgroup\$ Commented Jul 4 at 7:29
  • 2
    \$\begingroup\$ 37 bytes \$\endgroup\$
    – G B
    Commented Jul 4 at 7:30
  • \$\begingroup\$ @GB fantastic! the asterisk is not necessary, or have I missed something? \$\endgroup\$ Commented Jul 4 at 7:41
  • 2
    \$\begingroup\$ You get a nested list if you don't "splat". You are not seeing it because puts flattens the result. \$\endgroup\$
    – G B
    Commented Jul 4 at 11:11