100% faster, Binary search
Intuition\nwe need to find minimum ability among all. \nminimum ability is maximum of all robbed house. so we need to find k smallest rob.\n\n# Approach\nbrute 
# Intuition\nwe need to find minimum ability among all. \nminimum ability is maximum of all robbed house. so we need to find k smallest rob.\n\n# Approach\nbrute force approcah will take O(n2) so to optimise it we have to use Binary search on answer.\n\nwe will find that mid is answer or not. to check weatcher mid is answer i have implement a method valid.\n\n\n# Complexity\n- Time complexity:\n(n*log(n))\n\n- Space complexity:\nO(n) -> input vector\n\n# Code\n```\nclass Solution {\npublic:\n    \n    int valid(int mid,vector<int> &nums,int k){\n        int cn=0;\n        for(int i=0;i<nums.size();++i){\n            if(nums[i]<=mid){\n                cn++;\n                i++;\n            }\n        }\n        return cn>=k;\n    }\n\n    int minCapability(vector<int>& nums, int k) {\n        int lo=0,hi=1e9;\n        while(hi-lo>1){\n            int mid=(long long)(hi+lo)/2;\n            if(valid(mid,nums,k)){\n                hi=mid;\n            }else{\n                lo=mid;\n            }\n        }\n        return hi;\n    }\n};\n```
['C++']