BEST C++ solution || List of similar VERY IMP binary problems
List of similar binary search questions\n\n# Code\n\nclass Solution {\npublic:\n    int minCapability(vector<int>& A, int k) {\n        int start = 1, end = 1e9
# [List of similar binary search questions](https://leetcode.com/problems/koko-eating-bananas/solutions/3750804/best-c-solution-list-of-9-similar-very-imp-binary-search-questions/)\n\n# Code\n```\nclass Solution {\npublic:\n    int minCapability(vector<int>& A, int k) {\n        int start = 1, end = 1e9, n = A.size();\n        while (start < end){\n            int mid = (start + end) / 2, take = 0;\n            for (int i = 0; i < n; ++i)\n                if (A[i] <= mid)\n                    take++, i++;\n            if(take >= k)\n                end = mid;\n            else\n                start = mid + 1;\n        }\n        return start;\n    }\n};\n```
['C++']