걍가영 2024. 10. 15. 19:30

 

// 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)
}