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.

Required fields*

7
  • 3
    \$\begingroup\$ A very elegant solution! Couple of small saves: n{a=[]; -> n,*a{, and the first pair of parentheses isn't needed. \$\endgroup\$ Commented Aug 18, 2021 at 1:43
  • \$\begingroup\$ @Dingus Thanks! Down to 124 now. \$\endgroup\$ Commented Aug 18, 2021 at 20:08
  • \$\begingroup\$ 120 bytes \$\endgroup\$ Commented Aug 19, 2021 at 21:28
  • \$\begingroup\$ 119 bytes based on GB's golf. \$\endgroup\$ Commented Aug 20, 2021 at 3:40
  • \$\begingroup\$ @GB Wow that's clever, I never thought of counting down with n. If n is negative it can be divided by 2 directly (Ruby rounds to minus infinity so we get the right even-odd behaviour.) Just compare with -j and saves an additional 2 bytes. \$\endgroup\$ Commented Aug 20, 2021 at 9:13