본문 바로가기
Beakjoon&프로그래머스/Java

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

by 현장 2025. 2. 23.

-Code

import java.util.stream.LongStream;

class Solution {
    public long[] solution(int x, int n) {
        return LongStream.rangeClosed(1, n)
                .map(num -> num * x)
                .toArray();
    }
}