Love this solution! Using upto and downto in the context of a lift is just delightful.
upto
downto
A small improvement (arguably) could be to change stop to a proper bool throughout and then change
stop
stop = 0 lift.reject!{|n| n == floor && (stop = 1)}
to
stop = lift.delete(floor)
You could decompose the signature in the method definition if you like: def tribonacci({a,b,c}, n) do
def tribonacci({a,b,c}, n) do
Loading collection data...
Love this solution! Using
upto
anddownto
in the context of a lift is just delightful.A small improvement (arguably) could be to change
stop
to a proper bool throughout and then changeto
You could decompose the signature in the method definition if you like:
def tribonacci({a,b,c}, n) do