Easy understandable C++ solution || Binary search on answers approach
\n\nclass Solution {\npublic:\n    bool isPossible(vector<int>& candies, int mid, long long k){\n        long long count = 0;\n        int n = candies.size();\n
\n```\nclass Solution {\npublic:\n    bool isPossible(vector<int>& candies, int mid, long long k){\n        long long count = 0;\n        int n = candies.size();\n        for(int i=0; i<n; i++){\n            count += candies[i]/mid;\n        }\n\n        if(count < k){\n            return false;\n        }\n\n        return true;\n    }\n\n\n    int maximumCandies(vector<int>& candies, long long k) {\n        int start = 1, end = *max_element(candies.begin(), candies.end());\n        int ans = 0;\n        while(start <= end){\n            int mid = start + (end-start)/2;\n            if(isPossible(candies, mid, k)){\n                ans = mid;\n                start = mid+1;\n            }\n            else{\n                end = mid-1;\n            }\n        }\n\n        return ans;\n    }\n};\n```
['Array', 'Binary Search', 'C++']