Skip to content

Instantly share code, notes, and snippets.

@montogeek
Created March 5, 2017 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save montogeek/b28db692307aa3e80e8bc2889799d770 to your computer and use it in GitHub Desktop.
Save montogeek/b28db692307aa3e80e8bc2889799d770 to your computer and use it in GitHub Desktop.
function sumOfTwo(a, b, v) {
"strict mode"
const aSorted = a.sort((a, b) => a - b)
const bSorted = b.sort((a, b) => a - b)
for(var i = 0; i < aSorted.length; i++) {
for(var j = 0; j < bSorted.length; j++) {
if(aSorted[i] + bSorted[j] === v) {
return true
}
}
}
return false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment