You are viewing a single comment's thread. Return to all comments →
function findZigZagSequence(arr, n){ arr.sort((a,b)=> a-b);
let k = Math.floor((n+1)/2) - 1; [arr[k], arr[n-1]] = [arr[n-1], arr[k]]; let left = k+1, right = n-2; while(left<right){ [arr[left], arr[right]] = [arr[right], arr[left]] left++; right--; } const arry = arr.join(' ') console.log(arry)
}
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
process.stdin.resume(); process.stdin.setEncoding("ascii"); _input = ""; process.stdin.on("data", function (input) { _input += input; });
process.stdin.on("end", function () { processData(_input); });
Compiler Message Custom checker Failed: Success Input (stdin) 1 7 1 2 3 4 5 6 7 Your Output (stdout) 1 2 3 7 6 5 4 Expected Output 1 2 3 7 6 5 4 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'
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 →
function findZigZagSequence(arr, n){ arr.sort((a,b)=> a-b);
}
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
}
process.stdin.resume(); process.stdin.setEncoding("ascii"); _input = ""; process.stdin.on("data", function (input) { _input += input; });
process.stdin.on("end", function () { processData(_input); });
Compiler Message Custom checker Failed: Success Input (stdin) 1 7 1 2 3 4 5 6 7 Your Output (stdout) 1 2 3 7 6 5 4 Expected Output 1 2 3 7 6 5 4 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'