function solution(nums) { const max = nums.length/2; const typeOfCount = new Set(nums).size; return typeOfCount>max?max:typeOfCount; }