Skip to main content
deleted 2 characters in body
Source Link
l4m2
  • 28.5k
  • 2
  • 25
  • 104

JavaScript (Node.js), 9591 bytes

g=([p,q,...x],n=N=-1/0,...s)=>1/p?g(x,~~n+p,...s,p)&&g([q,...x],n,...s):N>n|s<g?S:(N=n,S=s)

Try it online!

JavaScript (Node.js), 95 94 bytes

a=>(N=g=([p,q,...x],n,...s)=>1/p?g(x,n+p,...s,p)+g&&g([q,...x],n,...s):N>n|s<g||[N=nN>n|s<g?S:(N=n,S=s]S=s))(a,0)&&S

Try it online!

awfulTry it online!

JavaScript (Node.js), 95 bytes

a=>(N=g=([p,q,...x],n,...s)=>1/p?g(x,n+p,...s,p)+g([q,...x],n,...s):N>n|s<g||[N=n,S=s])(a,0)&&S

Try it online!

awful

JavaScript (Node.js), 91 bytes

g=([p,q,...x],n=N=-1/0,...s)=>1/p?g(x,~~n+p,...s,p)&&g([q,...x],n,...s):N>n|s<g?S:(N=n,S=s)

Try it online!

JavaScript (Node.js), 95 94 bytes

a=>(N=g=([p,q,...x],n,...s)=>1/p?g(x,n+p,...s,p)&&g([q,...x],n,...s):N>n|s<g?S:(N=n,S=s))(a,0)

Try it online!

Source Link
l4m2
  • 28.5k
  • 2
  • 25
  • 104

JavaScript (Node.js), 95 bytes

a=>(N=g=([p,q,...x],n,...s)=>1/p?g(x,n+p,...s,p)+g([q,...x],n,...s):N>n|s<g||[N=n,S=s])(a,0)&&S

Try it online!

awful