Skip to content

Instantly share code, notes, and snippets.

@anish000kumar
Last active October 23, 2018 20:04
Show Gist options
  • Save anish000kumar/7262c10f8d8fbf21a88e87ac1f1bb581 to your computer and use it in GitHub Desktop.
Save anish000kumar/7262c10f8d8fbf21a88e87ac1f1bb581 to your computer and use it in GitHub Desktop.
hackerearch js boilerplate
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