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*

5
  • 1
    \$\begingroup\$ Nice approach. Btw, you can golf a byte by changing n==0 to n<1. In the question it states "A non-negative integer between 0 and 1,000,000,000". \$\endgroup\$ Commented Jun 15, 2017 at 10:45
  • 1
    \$\begingroup\$ @KevinCruijssen I golfed not 1, but 5 bytes with that clause! :-P Thanks, I hadn't noticed it. \$\endgroup\$ Commented Jun 15, 2017 at 11:12
  • 2
    \$\begingroup\$ You don't need a temp variable for the Fibonacci sequence. You can calculate successive pairs with b+=a;a=b-a; \$\endgroup\$ Commented Jun 16, 2017 at 7:31
  • 1
    \$\begingroup\$ You're doing black magic, @DavidConrad! I'm telling you! Black magic! :) \$\endgroup\$ Commented Jun 16, 2017 at 7:40
  • 1
    \$\begingroup\$ 37 bytes by taking input as unary and porting the Retina approach: s->s.matches(".?|(\\2?+(\\1|^.))*..") (Here an explanation of that regex.) \$\endgroup\$ Commented May 14, 2020 at 16:29