Binary Search can be this powerful
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
    Iterating for each `value` and checking whether `value` cars can 
    be fixed or not.
# Approach
<!-- Describe your approach to solving the problem. -->
    Using Binary Search to check for each value in logarithmic time.
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
    O(N log(M))

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
    O(1)
# Code
```cpp []
#define INCL()                                                                 \
    ios_base::sync_with_stdio(0);                                              \
    cin.tie(0);                                                                \
    cout.tie(0)

class Solution {
public:
    long long canFixTheseCars(long long count, vector<int>& ranks) {
        long long fixedCars = 0;

        for (const int& rank : ranks) {
            fixedCars += sqrt(count / rank);
        }

        return fixedCars;
    }

    long long repairCars(vector<int>& ranks, int cars) {
        INCL();

        long long result = 0;
        long long left = 1, right = LLONG_MAX;

        while (left <= right) {
            long long mid = left + (right - left) / 2;
            if (canFixTheseCars(mid, ranks) >= cars) { //if we can fix more cars than `cars`, check for lesser cars
                result = mid;
                right = mid - 1;
            } else {   // else check for higher cars
                left = mid + 1;
            }
        }

        return result;
    }
};
```
['Array', 'Binary Search', 'C++']