Distribute Candies

EasyArrayHash Table

Solution

export function distributeCandies(candyType: number[]): number {
  return Math.min(new Set(candyType).size, candyType.length / 2);
}