Baba ka no 

Run Settings
LanguageJavaScript
Language Version
Run Command
function processData(input) { let string = input.split('\n'); let n = string[0]; let arr = string[1].split(' ').map(Number); let new_arr = new Set() let pres ,pass = 0 for(let i=0;i<n;i++){ for(let j = 0;j<n;j++){ if (Math.abs(arr[i] - arr[j]) == 1){ // if (Math.abs(arr[i] - pres) == 1 && Math.abs(arr[i] - pass) == 1 || i==0){ new_arr.add(arr[i]) console.log(arr[i],arr[j]) } if(true){ new_arr.forEach((a,b) =>{ if(Math.abs(a - new_arr[b]) == 1){ console.log(a) } }) } } } } process.stdin.resume(); process.stdin.setEncoding("ascii"); _input = ""; process.stdin.on("data", function (input) { _input += input; }); process.stdin.on("end", function () { processData(_input); });
Editor Settings
Theme
Key bindings
Full width
Lines