C++|Discrete Binary search
\nclass Solution {\npublic:\n    bool check(long val,vector<int>&candies,long k){\n        long sum = 0;\n        for(auto it : candies){\n            sum += (i
```\nclass Solution {\npublic:\n    bool check(long val,vector<int>&candies,long k){\n        long sum = 0;\n        for(auto it : candies){\n            sum += (it/val);\n        }\n        return sum >= k;\n    }\n    int maximumCandies(vector<int>& candies, long long k) {\n        long start = 1, end = 1e9;\n        while(start < end){\n            long mid = (start + end) / 2;\n            if(!check(mid,candies,k)){\n                end = mid;\n            }\n            else start = mid+1;\n        }\n        return start-1;\n    }\n};\n```
['C', 'Binary Tree']