코딩테스트연습/프로그래머스
프로그래머스(1) - x만큼 간격이 있는 n개의 숫자[JAVA]
YJDawn
2024. 3. 15. 16:13
class Solution {
public long[] solution(int x, int n) {
long[] answer = new long[n];
answer[0] = x;
for(int i=1; i<n; i++) {
answer[i] = answer[i-1]+x;
}
return answer;
}
}