Development/코딩테스트

[백준] 5597번 Node.js

Yeony99 2022. 9. 4. 09:32
728x90
const fs = require('fs');
const input = require('fs').readFileSync('/dev/stdin').toString().trim().split('\n');

let start = 1;
let arr = input.map((num) => Number(num))
arr = arr.sort((a, b) => a-b)
  
while(start <= 30) {
  if(arr[start-1] !== start) {
    console.log(start)
    arr.splice(start-1, 0, start)
  }
  start++
}
728x90