python | easy to understand | 50% faster
\nclass Solution:\n    """\n    approach: \n    the problem can be tackled using binary search \n    max_candies that can be allocated to children = max(candies
```\nclass Solution:\n    """\n    approach: \n    the problem can be tackled using binary search \n    max_candies that can be allocated to children = max(candies)\n    min_candies that can be allocated to children = 1\n    \n    we will apply binary search on finding the optimal values of candies that can be\n    distributed to children. \n    """\n    def check_fulfilment(self, candies, elem, k):\n        count = 0\n        for candy in candies:\n            count+= candy // elem\n        if count >= k:\n            return True\n        return False\n    def maximumCandies(self, candies: List[int], k: int) -> int:\n        low = 1\n        high = max(candies)\n        if sum(candies) < k:\n            return 0\n        while low <= high:\n            mid = (low+high) // 2\n            # check if I can fulfil that order\n            status = self.check_fulfilment(candies, mid, k)\n            if status:\n                low = mid+1\n            else:         \n                high = mid-1\n        # low is the maximum number of candies that can be  distributed\n        return high\n```
['Binary Tree', 'Python']