손코딩
[프로그래머스] x만큼 간격이 있는 n개의 숫자 본문
728x90
728x90
import java.util.ArrayList;
class Solution {
public long[] solution(int x, int n) {
long[] answer = new long[n];
long y = x;
for(int i=0; i<n; i++){
answer[i] = y * (i+1);
}
return answer;
}
}
'Java' 카테고리의 다른 글
[프로그래머스] 완주하지 못한 선수 (0) | 2021.01.28 |
---|---|
[프로그래머스] 예산 (0) | 2021.01.28 |
[프로그래머스] 하샤드수 (0) | 2021.01.28 |
[프로그래머스] 콜라츠 추측 (0) | 2021.01.27 |
[프로그래머스] 짝수와 홀수 (0) | 2021.01.27 |