Distribute Candies

Jack
2 min readJan 17, 2021

Problem

Given an array of candies, determine the maximum amount of different candies one can eat if the maximum amount of candies to be consumed is n / 2, where n is the amount of candies.

Example:

Input: candyType = [1,1,2,2,3,3]
Output: 3
Explanation: Alice can only eat 6 / 2 =…

--

--

Jack

Magician, Mathematician, and Software Engineer