Skip to main content
added 33 characters in body
Source Link
Value Ink
  • 13.5k
  • 1
  • 18
  • 46

Ruby, 4040 36 bytes

Python answer port but Ruby strict typing means I can't coerce booleans into integers.

-4 bytes from dingledooper.

f=->n,a{n>0?a.sum{|e|f[n-e,a]}:n==0?1:01<<n} 

Try it online!Try it online!

Ruby, 40 bytes

Python answer port but Ruby strict typing means I can't coerce booleans into integers.

f=->n,a{n>0?a.sum{|e|f[n-e,a]}:n==0?1:0} 

Try it online!

Ruby, 40 36 bytes

Python answer port but Ruby strict typing means I can't coerce booleans into integers.

-4 bytes from dingledooper.

f=->n,a{n>0?a.sum{|e|f[n-e,a]}:1<<n} 

Try it online!

Source Link
Value Ink
  • 13.5k
  • 1
  • 18
  • 46

Ruby, 40 bytes

Python answer port but Ruby strict typing means I can't coerce booleans into integers.

f=->n,a{n>0?a.sum{|e|f[n-e,a]}:n==0?1:0} 

Try it online!