Binary search
Code
# Code
```cpp []
class Solution {
public:
    bool isPossible(vector<int>& ranks, int cars, long long mid){
        for(int i=0; i<ranks.size(); i++){
            cars-=floor(sqrt((double)mid/ranks[i]));
            if(cars<=0) return true;
        }
        return false;
    }
    long long repairCars(vector<int>& ranks, int cars) {
        long long l=0;
        long long h=1e14;
        long long ans = LLONG_MAX;
        while(l<=h){
            long long mid = l+(h-l)/2;
            if(isPossible(ranks, cars, mid)){
                ans=min(ans, mid);
                h=mid-1;
            }
            else l=mid+1;
        }
        return ans;    
    }
};
```
['Array', 'Binary Search', 'C++']