Search posts...
import java.util.*; class Solution { public int solution(int[] nums) { // 중복 제거 후 고유한 포켓몬의 수를 계산 HashSet<Integer> uniquePoke = new HashSet<>(); for (int num : nums) { uniquePoke.add(num); } return uniquePoke.size() > nums.length / 2 ? nums.length / 2 : uniquePoke.size(); } }
stupefyee