[C++] || Binary search || fastest
\nclass Solution {\npublic:\n    long long solve(vector<int>& c , long long mid){\n        int n = c.size();\n        long long cnt = 0;\n        for(int i = n-
```\nclass Solution {\npublic:\n    long long solve(vector<int>& c , long long mid){\n        int n = c.size();\n        long long cnt = 0;\n        for(int i = n-1 ; i >= 0 ; i--){\n            cnt += (c[i]/mid);\n        }\n        return cnt;\n    }\n    int maximumCandies(vector<int>& c, long long k) {\n        long long sol = 0;\n        int n = c.size();\n        int low = 1;\n        int high = *max_element(c.begin(),c.end());\n        while(low <= high){\n            long long mid = (high+low)/2;\n            cout<<mid<<" ";\n            if(solve(c,mid) >= k){\n                sol = mid;\n                low = mid+1;\n            }\n            else{\n                high = mid-1;\n            }\n        }\n        \n        return sol;\n\n    }\n};\n```
['C']