Binary Search || Explained
Explanation :\nBinary search between [1, max(candies)] to find the result.\nif we can allocate currCandy candies to k children. then update start, if not update
**Explanation :**\nBinary search between **[1, max(candies)]** to find the result.\n**if we can allocate currCandy candies to k children. then update start, if not update end.**\nSimilar Question : [https://leetcode.com/problems/koko-eating-bananas/]\n**Time O(Nlog(MaxC))\nSpace O(1)**\n    \n    \n```\nclass Solution {\npublic:\n    \n    bool doit(int currCandy, vector<int>& candies, long long k) {\n       \n\t\t// c candies can be divided into (c/currCandy) number of piles of size currCandy.\n        for (auto& c : candies)   k -= (c/currCandy);\n        return k <= 0;\n    }\n    \n    \n    int maximumCandies(vector<int>& candies, long long k) {\n        \n        int start(1), end(INT_MIN);\n        for (auto& candy : candies) end = max(end, candy);\n        \n        while (start <= end) {\n            int currCandy = start+(end-start)/2;\n\t\t\t// If we can divide the candies into piles containing currCandy number of candies all the numbers below currCandy can be distributed too.\n            if (doit(currCandy, candies, k))    start = currCandy+1;\n            else    end = currCandy-1;\n        }\n        return end;\n    }\n};\n```
['C', 'Binary Tree']