Day73

강태훈·2026년 4월 15일

nbcamp TIL

목록 보기
73/97

알고리즘 코드카타

Managers with at Least 5 Direct Reports

select name
from Employee
where id in (
    select managerId
    from Employee
    group by managerId
    having count(id) >= 5
);

기사단원의 무기

class Solution {
    public int solution(int number, int limit, int power) {
        int answer = 0;

        for (int i = 1; i <= number ; i++) {
            int count = measure(i);

            if(count > limit){
                answer += power;
            }else{
                answer += count;
            }
        }

        return answer;
    }

    public int measure(int number){
        int count = 0;
        for (int i = 1; i * i <= number; i++) {
            if (number % i == 0) {
                if (i * i == number) {
                    count++;
                } else {
                    count += 2;
                }
            }
        }
        return count;
    }
}

0개의 댓글