✏️ 작성한 코드
class Solution {
public int solution(int n) {
int answer = 0;
int cnt;
for(int i = 4; i <= n; i++){
cnt = 0;
for(int j = 1; j <= i; j++){
if(i % j == 0) cnt++;
}
if(cnt >= 3) answer++;
}
return answer;
}
}
'Algorithm > 프로그래머스' 카테고리의 다른 글
[Lv. 0] 모스부호(1) (0) | 2023.03.28 |
---|---|
[Lv. 0] 중복된 문자 제거 (0) | 2023.03.27 |
[Lv. 0] 문자열 정렬하기(2) (0) | 2023.03.27 |
[Lv. 0] 숫자찾기 (0) | 2023.03.22 |
[Lv. 0] 369 게임 (0) | 2023.03.21 |
댓글