C++ || [Binary Search]
Code\n\nclass Solution {\npublic:\n    int maximumCandies(vector<int>& arr, long long k) {\n          long long int result = 0 ;\n          long long int low  =
# Code\n```\nclass Solution {\npublic:\n    int maximumCandies(vector<int>& arr, long long k) {\n          long long int result = 0 ;\n          long long int low  = 1;\n          auto it = max_element(arr.begin() , arr.end());\n          long long int high = (long long int)(*it);\n          int n = arr.size();\n          while(low <= high){\n              long long int mid = low + (high - low)/2;\n              long long int count = 0;\n              for(int i = 0 ; i < n ; i++){\n                  count += ((long long int)arr[i] / mid);\n                  if(count >= k)break;\n              }\n              if(count >= k){\n                   result = mid;\n                   low = mid + 1;\n               }else{\n                   high = mid - 1;\n              }\n          }\n          return result;\n    }\n};\n```
['C++']