다른 사람의 풀이
import java.util.stream.IntStream;
class Solution {
public int solution(int n) {
return (int) IntStream.rangeClosed(1, n).filter(i -> (int) IntStream.rangeClosed(1, i).filter(i2 -> i % i2 == 0).count() > 2).count();
}
}
'프로그래머스(자바) > LV.0(자바)' 카테고리의 다른 글
중복된 문자제거 → Set자료형, 메서드 참조, distinct()★★ (0) | 2022.11.25 |
---|---|
모스부호(1) - HashMap get(key), put(key, value), indexOf(),substring() (0) | 2022.11.25 |
외계행성의 나이 →Stream끝판왕★ (0) | 2022.11.25 |
369게임 → count()★, Stream개념정리용★ (0) | 2022.11.25 |
피자 나뉘 먹기(2) ★최소공배수, 최대공약수★ (0) | 2022.11.25 |