Easy Binary search Solution || Beats 100% online submissions
Code\n\nclass Solution {\n    public int minCapability(int[] nums, int k) {\n        int lo = Integer.MAX_VALUE, hi = Integer.MIN_VALUE;\n\n        for(int it :
# Code\n```\nclass Solution {\n    public int minCapability(int[] nums, int k) {\n        int lo = Integer.MAX_VALUE, hi = Integer.MIN_VALUE;\n\n        for(int it : nums){\n            lo = Math.min(lo, it);\n            hi = Math.max(hi, it);\n        }\n\n        while(lo < hi){\n            int mid = lo + (hi-lo)/2;\n            if(check(nums,k,mid)){\n                hi = mid;\n            }\n            else{\n                lo = mid+1;\n            }\n        }\n\n        return lo;\n    }\n\n    private boolean check(int[] nums, int k, int val){\n        int ct = 0;\n\n        for(int i = 0;i < nums.length;i++){\n            if(nums[i] <= val){\n                i++;\n                ct++;\n                if(ct == k) return true;\n            }\n        }\n\n        return ct >= k;\n    }\n}\n```
['Array', 'Binary Search', 'Java']