You are viewing a single comment's thread. Return to all comments →
ZigZag task - in JavaScript
When I am testing with custom input which is as below :
2 7 1 2 3 4 5 6 7 5 5 3 1 2 4
My solution is passing. When I run with hackerrank test case it is failing.
My solution below:
function processData(input) { //Enter your code here let lines = input.trim().split("\n"); let t = parseInt(lines[0]); let index =1;
for (let i = 0; i < t; i++) { let arr = lines[index + 1].trim().split(' ').map(Number); findZigZagSequence(arr); index += 2; } function findZigZagSequence(a){ let sortedArr = a.sort((a,b)=>a-b) const midIndex = Math.floor((sortedArr.length)/2) const increasePart= sortedArr.splice(midIndex).reverse() const zigZag=([...sortedArr,...increasePart]).join(' ') console.log(zigZag) }
}
process.stdin.resume(); process.stdin.setEncoding("ascii"); _input = ""; process.stdin.on("data", function (input) { _input += input; });
The error :
Custom Checker Error Message Traceback (most recent call last): File "Solution.py", line 174, in run_custom_checker(t_obj, r_obj) File "Solution.py", line 75, in run_custom_checker system_code = code_data[t_obj.submission_language].strip() KeyError: u'javascript' process.stdin.on("end", function () { processData(_input); });
Means HackerRank is trying to run a Python-specific checker on a JavaScript submission, which it doesn't support for this problem.
Seems like cookies are disabled on this browser, please enable them to open this website
Zig Zag Sequence
You are viewing a single comment's thread. Return to all comments →
ZigZag task - in JavaScript
When I am testing with custom input which is as below :
2 7 1 2 3 4 5 6 7 5 5 3 1 2 4
My solution is passing. When I run with hackerrank test case it is failing.
My solution below:
function processData(input) { //Enter your code here let lines = input.trim().split("\n"); let t = parseInt(lines[0]); let index =1;
}
process.stdin.resume(); process.stdin.setEncoding("ascii"); _input = ""; process.stdin.on("data", function (input) { _input += input; });
The error :
Custom Checker Error Message Traceback (most recent call last): File "Solution.py", line 174, in run_custom_checker(t_obj, r_obj) File "Solution.py", line 75, in run_custom_checker system_code = code_data[t_obj.submission_language].strip() KeyError: u'javascript' process.stdin.on("end", function () { processData(_input); });
Means HackerRank is trying to run a Python-specific checker on a JavaScript submission, which it doesn't support for this problem.