Easy Binary Search | Beat 100%
\n# Code\n\nclass Solution {\npublic:\n    int minCapability(vector<int>& nums, int k) {\n        int N = nums.size();\n        int left = 1, right = 1e9;\n    
\n# Code\n```\nclass Solution {\npublic:\n    int minCapability(vector<int>& nums, int k) {\n        int N = nums.size();\n        int left = 1, right = 1e9;\n        while (left < right) {\n            int mid = left + (right - left) / 2;\n            int cnt = 0;\n            for (int i = 0; i < N; i++) {\n                if (nums[i] <= mid) {\n                    cnt++;\n                    i++; // skip adjacent index\n                }\n            }\n            if (cnt < k) {\n                left = mid+1;\n            } else {\n                right = mid;\n            }\n        }\n        return left;\n    }\n};\n```
['C++']