프로그래머스-폰켓몬

이호영·2022년 4월 5일
0
import java.util.*;

class Solution {
    public int solution(int[] nums) {
        Set<Integer> type = new HashSet<>();
        int pick = nums.length/2;
        
        for(int poke: nums) {
            type.add(poke);
        }
        
        return Math.min(type.size(), pick);
    }
}

0개의 댓글