본문 바로가기

프로그래머스(코딩 테스트)/Lv.0

짝수는 싫어요

 

// javascript
const solution = (n) => {
    return Array.from({length:Math.ceil(n / 2)}, (_, index) => index * 2 + 1)
}

 

// typescript
const solution = (n:number[]):number[] => {
    return Array.from({length:Math.ceil(n / 2)}, (_, index) => index * 2 + 1)
}

'프로그래머스(코딩 테스트) > Lv.0' 카테고리의 다른 글

배열 두배 만들기  (0) 2024.10.15
나머지 구하기  (0) 2024.10.15
편지  (0) 2024.10.15
짝수의 합  (0) 2024.10.15
중복된 문자 제거  (0) 2024.10.15