Skip to main content
-1 byte
Source Link
dingledooper
  • 23.4k
  • 1
  • 40
  • 130

Python 2, 5050 49 bytes

-1 byte thanks to @Jonathan Allan

f=lambda n,A:n>0and sumn>=0and(n<1)+sum(f(n-x,A)for x in A)or n==0 

Try it online!Try it online!

Python 2, 50 bytes

f=lambda n,A:n>0and sum(f(n-x,A)for x in A)or n==0 

Try it online!

Python 2, 50 49 bytes

-1 byte thanks to @Jonathan Allan

f=lambda n,A:n>=0and(n<1)+sum(f(n-x,A)for x in A) 

Try it online!

Source Link
dingledooper
  • 23.4k
  • 1
  • 40
  • 130

Python 2, 50 bytes

f=lambda n,A:n>0and sum(f(n-x,A)for x in A)or n==0 

Try it online!