Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save renganatha10/f466106ea385f8d1dc4937db8dc16fb0 to your computer and use it in GitHub Desktop.
Save renganatha10/f466106ea385f8d1dc4937db8dc16fb0 to your computer and use it in GitHub Desktop.
onlineChallenges.js
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