Posts by snail_
Ruby, 27 bytes ->n{x=[];n.times{x<<x*1};x} ->n{ } # lambda taking n x=[]; # set x to empty array n.times{ }; # repeat...
Ruby, 8 bytes ->n{n%2} Generic mod-in-a-lambda solution. Alternately, for 2.7+: ->{_1%2} Try it online!
Two words are anagrams of each other if the letters of one can be reordered to spell the other; e.g. ADOBE and ABODE are anagrams. An alternate way of describing it is that both words contain the s...
Ruby, 43 bytes ->n{(1..n).map{|i|" "*(n-i)+?/*i+?\\*i}*$/} ->n{ } # lambda (1..n).map{|i| } # map over 1 to n ...
Ruby, 38 bytes Simple map and sum over the coefficients. No TIO link, this uses numbered lambda parameters which require Ruby 2.7. ->l,x{l.each_with_index.sum{_1*x**_2}}
Ahead, 3 bytes SW@ S Slurp entire input to stack W Write entire stack @ End Try it online!
- ← Previous
- 1
- 2
- Next →