Posts by snail_
Ruby, 8 bytes ->n{n%2} Generic mod-in-a-lambda solution. Alternately, for 2.7+: ->{_1%2} Try it online!
Ruby, 53 bytes ->n{n-=3;[?╔+?╦*n+?╗,*[?╠+?╬*n+?╣]*(n+1),?╚+?╩*n+?╝]} Try it online!
Ruby, 23 bytes ->a,b{a==2&&b==2?5:a+b} Try it online!
Ruby, 11 bytes ->n{"%b"%n} Simple string formatting. Try it online!
Ruby, 51 50 bytes -1 from Razetime ->p,n{while i=p.find{(_1*n).to_f%1==0} n*=i end n} Try it online!
Omitting parens on function calls You can omit parentheses on function calls in many cases. foo(bar,baz) foo bar,baz This is even true if a function call doesn't have any parameters. (This is...
BQN, 13 bytes {+´(𝕨⋆↕≠𝕩)×𝕩} { } # fn +´ # sum reduce (𝕨⋆↕≠𝕩) # x^i for each term ×𝕩 # times each coefficient Try it
- ← Previous
- 1
- 2
- Next →