[프로그래머스 | Lv. 1 | JavaScript] x만큼 간격이 있는 n개의 숫자
·
알고리즘/문제
Link코딩테스트 연습 - x만큼 간격이 있는 n개의 숫자 문제풀이(1)function solution(x, n) { let answer = []; let sum = x; for(let i = 1; i (2)function solution(x, n) { return Array(n).fill(x).map((item, idx) => item * (idx + 1))}(3)function solution(x, n) { return Array.from({ length: n }, (_, i) => x * (i + 1));}