I have a coding challenge coming up that will be using HackerRank, which I am unfamiliar with. I started trying to get familiar with it before I started and imagine my surprise when I saw this boilerplate-ish code in the editor!
process.stdin.resume();
process.stdin.setEncoding('ascii');
var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;
process.stdin.on('data', function (data) {
input_stdin += data;
});
process.stdin.on('end', function () {
input_stdin_array = input_stdin.split("\n");
main();
});
function readLine() {
return input_stdin_array[input_currentline++];
}
The rest of the challenges on HR have slightly modified versions of this and I can't help but wonder what is really going on. It seems like there is some sort of text file that the editor is reading from and is therefore able to compare to my output?
I'd really appreciate any insight into this as I am pretty sure that I will have to write my own Node "boilerplate" when I do my coding challenge.
Thanks!
Aucun commentaire:
Enregistrer un commentaire