Created
January 11, 2019 18:40
-
-
Save misterpoloy/3e6502fa3f60642a88ab0cbfcfb719ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.stdin.resume(); | |
process.stdin.setEncoding("ascii"); | |
var input = ""; | |
process.stdin.on("data", function (chunk) { | |
input += chunk; | |
}); | |
process.stdin.on("end", function () { | |
// now we can read/parse input | |
let response = false; | |
// Check elements of input | |
if (!input) return response; | |
const elements = input.split('\n'); | |
const array = elements[1].split(" "); | |
const target = parseInt(elements[2]); | |
let i = 0; | |
while (i < array.length && response === false) { | |
array.forEach(number => { | |
// Check parse vars to target | |
if ((parseInt(array[i]) + parseInt(number)) === target) { | |
response = 'True'; | |
} | |
}); | |
i++; | |
} | |
console.log(response); | |
return response; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment