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*

4
  • 1
    \$\begingroup\$ can you replace i<=1 with i<2 ? \$\endgroup\$ Commented Mar 1, 2017 at 10:02
  • 1
    \$\begingroup\$ You could save a few bytes with a lambda: (n,i)->{...} \$\endgroup\$ Commented Mar 2, 2017 at 14:50
  • \$\begingroup\$ Java 8 lambdas ftw \$\endgroup\$ Commented Mar 2, 2017 at 22:03
  • 1
    \$\begingroup\$ Hmm, looks like this takes extra input. You'll need to make a separate method of just one parameter in order for this to be valid. \$\endgroup\$ Commented Jun 24, 2018 at 1:24