Created
March 16, 2017 19:36
-
-
Save renganatha10/f466106ea385f8d1dc4937db8dc16fb0 to your computer and use it in GitHub Desktop.
onlineChallenges.js
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
function main(input) { | |
input=input.split(/\s+/); | |
var output = 1; | |
var init = input[1]; | |
for(var i = 1; i < input[0]; i++){ | |
if(temp < input[i + 1] ){ | |
output++; | |
} | |
temp = input[i + 1]; | |
} | |
process.stdout.write(output); | |
} | |
process.stdin.resume(); | |
process.stdin.setEncoding("utf-8"); | |
var stdin_input = ""; | |
process.stdin.on("data", function (input) { | |
stdin_input += input; | |
}); | |
process.on('SIGINT', function(){ | |
main(stdin_input); | |
process.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment