Last active
October 23, 2018 20:04
-
-
Save anish000kumar/7262c10f8d8fbf21a88e87ac1f1bb581 to your computer and use it in GitHub Desktop.
hackerearch js boilerplate
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("utf-8"); | |
var stdin_input = ""; | |
process.stdin.on("data", function (input) { | |
stdin_input += input; // Reading input from STDIN | |
}); | |
process.stdin.on("end", function () { | |
main(stdin_input); | |
}); | |
function log(..._x){ | |
if(_x){ | |
_x.forEach(x=>{ | |
if(Array.isArray(x) || typeof x =="object"){ | |
process.stdout.write(JSON.stringify(x)+"\n") | |
} | |
else | |
process.stdout.write(x+"\n"); | |
}) | |
} | |
} | |
function main(input) { | |
input = input.split("\n"); | |
let count = input[0]; | |
for(let i =0 ; i < count; i ++){ | |
let n = input[2*i+1].split(" ")[0]; | |
let q = input[2*i+1].split(" ")[1]; | |
let heights = input[2*i+2].split(" "); | |
getPrice(n, q, heights); | |
} | |
} | |
function getPrice(n, q, heights){ | |
log(n,q, heights) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment