프로그래머스/LEVEL 1
x만큼 간격이 있는 n개의 숫자
GenieLove!
2021. 3. 7. 20:52
728x90
반응형
Java
class Solution {
public long[] solution(long x, int n) {
long[] answer = new long[n];
for(int i = 0; i < n; i++)
answer[i] = x * (i + 1);
return answer;
}
}
Python
def solution(x, n):
return [x * (i + 1) for i in range(n)]
728x90
반응형