a simply python solution ,with 2 line


  • 0
    F

    if the kinds of candies large than the candies sister can obtain ,she will get kinds of candies which she can get ,or she will get all kinds of candie.

    def distributeCandies(self, candies):
            candy = set(candies)
            return min(len(candy),len(candies)/2)
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.