짝수의 합 (스트림이용, IntStream.rangeClosed, sum)

Psj·2일 전
0

코딩테스트

목록 보기
26/30


내풀이

import java.util.stream.*;

class Solution {
    public int solution(int n) {
        return IntStream.rangeClosed(1,n).filter(i->i%2 == 0).sum();
    }
}
profile
Software Developer

0개의 댓글

관련 채용 정보