🔥 100% Simple & Easy solution! ✅| 🎯Beats 95.45 |🚀 Binary Search | O(N log M) | C++
IntuitionWe need to find the minimum capability of the robber, meaning the smallest maximum amount of money stolen from a single house while robbing at least k
# Intuition
We need to find the minimum capability of the robber, meaning the smallest maximum amount of money stolen from a single house while robbing at least `k` houses. Since the houses are arranged in a linear fashion, and adjacent houses cannot be robbed together, we can use **Binary Search on Answer** to efficiently determine the minimum capability.

# Approach
1. **Binary Search on Capability (`m`)**  
   - The minimum possible capability is `min(nums)`, and the maximum possible capability is `max(nums)`.
   - We perform binary search in this range to find the smallest possible capability that allows robbing at least `k` houses.

2. **Checking Feasibility (`solve` function)**  
   - We iterate through `nums`, selecting houses that have money ≤ `m`.
   - If a house is selected, we skip the next one to maintain the constraint of not robbing adjacent houses.
   - If we can select at least `k` houses, then `m` is a valid capability.

3. **Binary Search Execution**  
   - Initialize `low = min(nums)` and `high = max(nums)`.
   - Perform binary search:
     - Compute `mid = (low + high) / 2`.
     - If we can rob at least `k` houses with capability `mid`, update `ans = mid` and search for a smaller `mid` (left side).
     - Otherwise, search on the right side by increasing `low`.

# Complexity
- **Time Complexity:**  
  - **O(n log(max-min))**  
  - The binary search runs in **O(log(max-min))**, and the `solve` function runs in **O(n)**.

- **Space Complexity:**  
  - **O(1)**, as we use only a few extra variables.

# Code
```cpp
class Solution {
public:
    bool solve(vector<int>& nums, int m, int k) {
        int count = 0;
        for (int i = 0; i < nums.size(); i++) {
            if (nums[i] <= m) {
                count++;
                i++;  // Skip next house
            }
            if (count >= k) return true;
        }
        return false;
    }

    int minCapability(vector<int>& nums, int k) {
        int low = *min_element(nums.begin(), nums.end());
        int high = *max_element(nums.begin(), nums.end());
        int ans = high;

        while (low <= high) {
            int mid = (low + high) / 2;
            if (solve(nums, mid, k)) {
                ans = mid;
                high = mid - 1;
            } else {
                low = mid + 1;
            }
        }
        return ans;
    }
};

['Binary Search', 'C++']