문제 유형: 해시
https://school.programmers.co.kr/learn/courses/30/lessons/1845
프로그램 제작자
코드 중심 개발자를 고용하십시오. 배치 기반 위치 매칭. 프로그래머의 개발자별 프로필에 가입하고 기술 호환성이 좋은 회사와 연결하십시오.
Programmer.co.kr
문제를 도식화하다
전체 코드
function solution(nums) {
// 뽑을 수 있는 포켓몬 : 길이/2
let max = nums.length/2;
// 폰켓몬 종류 : 중복 숫자 제외
const hash = new Set(nums) // 배열을 set 변환
//console.log(hash) 〉 Set(3) { 3, 1, 2 }
//console.log(hash.size) // hash.size : 3
let answer = max > hash.size ? hash.size : max
return answer;
}