Beakjoon&프로그래머스/Java
[프로그래머스/Java] x만큼 간격이 있는 n개의 숫자
현장
2025. 2. 23. 16:12
-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();
}
}