Skip to main content
deleted 69 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

JavaScript, 6965 bytes

I took a wrong turn on this somewhere! The eval & slice are annoying me, as is the need for y.!

x=>g=(n,y,...a)=>n?g(n-1,-~y,...a,x<=ya[x-1]?eval(a.slice(-x).join`+`):1):a

Try it online!Try it online!

JavaScript, 69 bytes

I took a wrong turn on this somewhere! The eval & slice are annoying me, as is the need for y.

x=>g=(n,y,...a)=>n?g(n-1,-~y,...a,x<=y?eval(a.slice(-x).join`+`):1):a

Try it online!

JavaScript, 65 bytes

The eval & slice are annoying me!

x=>g=(n,...a)=>n?g(n-1,...a,a[x-1]?eval(a.slice(-x).join`+`):1):a

Try it online!

Post Undeleted by Shaggy
added 153 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

JavaScript, 6469 bytes

I took a wrong turn on this somewhere! The eval & slice are annoying me, as is the need for y.

x=>g=(n,y,...a)=>n?g(n-1,-~y,...a,n-x<xx<=y?eval(a.slice(-x).join`+`):1):a

Try it online!Try it online!

JavaScript, 64 bytes

x=>g=(n,...a)=>n?g(n-1,...a,n-x<x?eval(a.slice(-x).join`+`):1):a

Try it online!

JavaScript, 69 bytes

I took a wrong turn on this somewhere! The eval & slice are annoying me, as is the need for y.

x=>g=(n,y,...a)=>n?g(n-1,-~y,...a,x<=y?eval(a.slice(-x).join`+`):1):a

Try it online!

Post Deleted by Shaggy
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

JavaScript, 64 bytes

x=>g=(n,...a)=>n?g(n-1,...a,n-x<x?eval(a.slice(-x).join`+`):1):a

Try it online!