Posts by radarek
Ruby, 25 bytes Credits goes to @Shaggy and his JavaScript solution. ->a,l{l.map{a.sort! &_1}} Try this online! The other solution which not mutate original array
Ruby, 22 bytes ->{(1.._2).reduce &_1} Try this online! Without using reduce (28 bytes): f=->g,n{n<2?n:g[n,f[g,n-1]]} Try this online!
Ruby, 100 96 bytes According to the rules, trailing white spaces and line feed are allowed and my program uses that: ->p,s{"Par Bogey Double bogey Triple bogey Hole in one Albatross Eagl...
Ruby, 27 24 bytes ->n,m{eval'-~rand(m)'*n} Attempt This Online! If we change the order of n, m parameters to m, n then following 23 bytes version work, but only in ruby 2.7 (it does not work ...
Ruby, 29 bytes ->l,x{a,*b=l;a ?a+x*f[b,x]:0} Try it online
Ruby, 27 bytes ->n{(2..n).all?{n%_1**2>0}} Try it online
- ← Previous
- 1
- 2
- Next →