💻
public class Solution {
public long[] solution(int x, int n) {
long[] answer = new long[n];
for(int i = 0; i < n; i++)
{
if(i != 0)
{
answer[i] += answer[i-1] + x;
}
else
answer[i] = x;
}
return answer;
}
}
'프로그래머스 > Lv.1' 카테고리의 다른 글
[프로그래머스 C#] 나머지가 1이 되는 수 찾기 (0) | 2023.08.27 |
---|---|
[프로그래머스 C#] 직사각형 별찍기 (0) | 2023.08.23 |
[프로그래머스 C#] 자연수 뒤집어 배열로 만들기 (0) | 2023.08.22 |
[프로그래머스 C#] 자릿수 더하기 (0) | 2023.08.22 |
[프로그래머스 C#] 문자열 다루기 기본 (0) | 2023.08.21 |