[백준2752_자바스크립트(javascript)] - 세수정렬

경이·2024년 1월 9일

𝑩𝑶𝑱 (𝒋𝒔)

목록 보기
11/325

🔴 문제

세수정렬


🟡 Sol

const readline = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout,
});

let input = [];

readline
  .on('line', (line) => {
    input = line.split(' ');
    readline.close();
  })
  .on('close', () => {
    solutiuon(input);
    process.exit();
  });

function solutiuon(input) {
  const a = input.map((it) => parseInt(it)).sort((a, b) => a - b);
  console.log(a.join(' '));
}

🟢 풀이

인터페이스 열어서 받아봤는데 개별로인듯
join() 메서드 사용해서 출력해준다.


🔵 Ref

profile
록타르오가르

0개의 댓글