Skip to main content
Commonmark migration
Source Link

##Javascript, 114 96 86 84 bytes

Javascript, 114 96 86 84 bytes

a=>b=>{c=b.length;for(x=0;x<c;x++)for( y=x;++y<c;)if(b[x]+b[y]==a)return[b[x],b[y]]} 

Saved 1 byte thanks to @Cyoce and another 8 bytes thanks to @ETHProductions

This returns a tuple with the first combination of list-elements that sum up to the given input, or nothing for no match. I've removed the vars in the function; REPL.it crashes without them, but the Chrome Dev Console handles this just fine...

Try it online!

##Javascript, 114 96 86 84 bytes

a=>b=>{c=b.length;for(x=0;x<c;x++)for( y=x;++y<c;)if(b[x]+b[y]==a)return[b[x],b[y]]} 

Saved 1 byte thanks to @Cyoce and another 8 bytes thanks to @ETHProductions

This returns a tuple with the first combination of list-elements that sum up to the given input, or nothing for no match. I've removed the vars in the function; REPL.it crashes without them, but the Chrome Dev Console handles this just fine...

Try it online!

Javascript, 114 96 86 84 bytes

a=>b=>{c=b.length;for(x=0;x<c;x++)for( y=x;++y<c;)if(b[x]+b[y]==a)return[b[x],b[y]]} 

Saved 1 byte thanks to @Cyoce and another 8 bytes thanks to @ETHProductions

This returns a tuple with the first combination of list-elements that sum up to the given input, or nothing for no match. I've removed the vars in the function; REPL.it crashes without them, but the Chrome Dev Console handles this just fine...

Try it online!

added 8 characters in body
Source Link
steenbergh
  • 8.2k
  • 1
  • 27
  • 43

##Javascript, 114 96 8686 84 bytes

a=>b=>{for(x=0;x<bc=b.length;x++length;for(x=0;x<c;x++)for(y=x;++y<b.length; y=x;++y<c;)if(b[x]+b[y]==a)return[b[x],b[y]]} 

Saved 1 byte thanks to @Cyoce and another 8 bytes thanks to @ETHProductions

This returns a tuple with the first combination of list-elements that sum up to the given input, or nothing for no match. I've removed the vars in the function; REPL.it crashes without them, but the Chrome Dev Console handles this just fine...

Try it online!

##Javascript, 114 96 86 bytes

a=>b=>{for(x=0;x<b.length;x++)for(y=x;++y<b.length;)if(b[x]+b[y]==a)return[b[x],b[y]]} 

Saved 1 byte thanks to @Cyoce and another 8 bytes thanks to @ETHProductions

This returns a tuple with the first combination of list-elements that sum up to the given input, or nothing for no match. I've removed the vars in the function; REPL.it crashes without them, but the Chrome Dev Console handles this just fine...

Try it online!

##Javascript, 114 96 86 84 bytes

a=>b=>{c=b.length;for(x=0;x<c;x++)for( y=x;++y<c;)if(b[x]+b[y]==a)return[b[x],b[y]]} 

Saved 1 byte thanks to @Cyoce and another 8 bytes thanks to @ETHProductions

This returns a tuple with the first combination of list-elements that sum up to the given input, or nothing for no match. I've removed the vars in the function; REPL.it crashes without them, but the Chrome Dev Console handles this just fine...

Try it online!

added 47 characters in body
Source Link
steenbergh
  • 8.2k
  • 1
  • 27
  • 43

##Javascript, 114 9696 86 bytes

a=>b=>{for(x=0;x<b.length;x++){for(y=x+1;y<by=x;++y<b.length;y++length;){if(b[x]+b[y]==a){return [b[x]return[b[x],b[y]]}}}} 

Saved 1 byte thanks to @Cyoce and another 8 bytes thanks to @ETHProductions

This returns a tuple with the first combination of list-elements that sum up to the given input, or nothing for no match. I've removed the vars in the function; REPL.it crashes without them, but the Chrome Dev Console handles this just fine...

Try it online!Try it online!

##Javascript, 114 96 bytes

a=>b=>{for(x=0;x<b.length;x++){for(y=x+1;y<b.length;y++){if(b[x]+b[y]==a){return [b[x],b[y]]}}}} 

Saved 1 byte thanks to @Cyoce

This returns a tuple with the first combination of list-elements that sum up to the given input, or nothing for no match. I've removed the vars in the function; REPL.it crashes without them, but the Chrome Dev Console handles this just fine...

Try it online!

##Javascript, 114 96 86 bytes

a=>b=>{for(x=0;x<b.length;x++)for(y=x;++y<b.length;)if(b[x]+b[y]==a)return[b[x],b[y]]} 

Saved 1 byte thanks to @Cyoce and another 8 bytes thanks to @ETHProductions

This returns a tuple with the first combination of list-elements that sum up to the given input, or nothing for no match. I've removed the vars in the function; REPL.it crashes without them, but the Chrome Dev Console handles this just fine...

Try it online!

added 34 characters in body
Source Link
steenbergh
  • 8.2k
  • 1
  • 27
  • 43
Loading
added 161 characters in body
Source Link
steenbergh
  • 8.2k
  • 1
  • 27
  • 43
Loading
Source Link
steenbergh
  • 8.2k
  • 1
  • 27
  • 43
Loading