BS on Answer
IntuitionBS on AnswerApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
BS on Answer

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
#define ll long long

class Solution {
public:
    bool ispossi(vector<int> &ranks, ll mid, ll cars) {
        ll total_cars = 0;
        for (int rank : ranks) {
            ll max_cars = (ll) sqrt(mid / rank);
            total_cars += max_cars;

            if (total_cars >= cars) return true; 
        }
        
        return total_cars >= cars;
    }

    long long repairCars(vector<int>& ranks, int cars) {
        ll l = 1;
        ll r = *min_element(ranks.begin(), ranks.end()) * (ll)cars * (ll)cars;


        while (l < r) {
            ll mid = (l + r) / 2;
            if (ispossi(ranks, mid, cars)) {
                r = mid;
            } else {
                l = mid + 1;
            }
        }
        return l;
    }
};

```
['C++']