BOJ 2920

슬기로운 FE 세상·2022년 3월 19일
0

const input = require('fs').readFileSync('./input.txt').toString().trim().split(' ');

let count = 0;
for(let i=0; i<input.length; i++) {
    if(input[i] < input[i+1]) {
        count++;
    }
}

const result = {
    7: 'ascending',
    0: 'descending',
}[count]

console.log(result || 'mixed')

input[i] < input[i+1]의 숫자를 count로 확인하여 그에 맞는 string값 출력

profile
자 드가자~~

0개의 댓글