Binary Search on Answer
\nclass Solution {\nprivate:\n    bool canRepairAllCars(long long potentialMinTime, int totalCars, vector<int>& ranks)\n    {\n        long long repairCapacityW
```\nclass Solution {\nprivate:\n    bool canRepairAllCars(long long potentialMinTime, int totalCars, vector<int>& ranks)\n    {\n        long long repairCapacityWithPotentialMinTime = 0;\n        for(auto rank : ranks) repairCapacityWithPotentialMinTime += sqrt(potentialMinTime/rank);\n        return repairCapacityWithPotentialMinTime >= totalCars;\n    }\npublic:\n    long long repairCars(vector<int>& ranks, int cars) {\n        \n        long long low = 1, high = LONG_MAX, potentialMinTime, minTimeToRepairCars = LONG_MAX;\n        \n        while(low <= high)\n        {\n            potentialMinTime = low + (high - low) / 2;\n            \n            if(canRepairAllCars(potentialMinTime, cars, ranks)){\n                minTimeToRepairCars = potentialMinTime;\n                high = potentialMinTime - 1;\n            }\n            else low = potentialMinTime + 1;\n        }\n        return minTimeToRepairCars;\n    }\n};\n```
['Binary Search', 'C++']