슈콩

[프로그래머스] x만큼 간격이 있는 n개의 숫자 본문

Algorithms/Programmers

[프로그래머스] x만큼 간격이 있는 n개의 숫자

shukong 2025. 10. 25. 23:20

 

 

[문제]

https://school.programmers.co.kr/learn/courses/30/lessons/12954

 

프로그래머스

SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프

programmers.co.kr

 

 

 

[소스 코드]

class Solution {
    public long[] solution(int x, int n) {
        long[] answer = new long[n];
        long val = x;
        for(int i=0;i<n;i++){
            answer[i] = val;
            val += x;
        }
        return answer;
    }
}