[C++, Java, Python3] Binary Search + 1 liner
\n# Intuition\nA mechanic can repair n cars in r * n * n minutes. So in mid minutes a mechanic can repair n cars where, n = sqrt(mid / r) \nLet\'s assume that t
\n# Intuition\nA mechanic can repair `n` cars in `r * n * n` minutes. So in `mid` minutes a mechanic can repair `n` cars where, `n = sqrt(mid / r)` \nLet\'s assume that the correct answer is `mid` minutes, we can find the number of cars each mechanic can repair in `mid` minutes, then find the find the total number of cars fixed. If total number of cars fixed is greater than or equal to the cars we have to repair, `mid` minutes is a valid answer, else we have to increase `mid`. We can not linearly calculate total cars fixed for each mid in (0 to 10^14), we must use binary search to lower the time complexity.\n\n# Approach\n* Total cars repaired by all workers in `mid` minutes must be greater than or equal to total cars that have to be repaired\n* Binary search over the range `0 to 10^14` to find what is the minimum time required to repair all cars\n* We use high as `10^14` because `max(rank) = 100` and `max(cars) = 10^6` so, `r * n * n = 100 * 10^6 * 10^6 = 10^14`\n\n# Complexity\n- Time complexity: `O(nlog(10^14))`\n\n- Space complexity: `O(1)`\n\n# Code\n**C++**:\n```\nlong long repairCars(vector<int>& ranks, int cars) {\n    long long low = 0, high = 1e14;\n    while (low < high) {\n        long long mid = low + (high - low) / 2, repaired_cars = 0;\n        for (int& r: ranks)\n            repaired_cars += sqrt(mid / r);\n        if (repaired_cars < cars) low = mid + 1;\n        else high = mid;\n    }\n    return low;\n}\n```\n\n**Java**:\n```\npublic long repairCars(int[] ranks, int cars) {\n    long low = 0, high = (long)1e14;\n    while (low < high) {\n        long mid = low + (high - low) / 2, repaired_cars = 0;\n        for (int r: ranks)\n            repaired_cars += Math.sqrt(mid / r);\n        if (repaired_cars < cars) low = mid + 1;\n        else high = mid;\n    }\n    return low;\n}\n```\n\n**Python3**:\n```\ndef repairCars(self, A: List[int], cars: int) -> int:\n    return bisect_left(range(10**14), cars, key=lambda x: sum(int(sqrt(x / a)) for a in A))\n```\n\nSimilar Questions:\n[Minimum Time to Complete Trips](https://leetcode.com/problems/minimum-time-to-complete-trips/solutions/1802415/python3-java-c-binary-search-1-liner/)\n[Kth Missing Positive Number](https://leetcode.com/problems/kth-missing-positive-number/solutions/3262163/c-java-python3-1-line-ologn/)\n[Maximum Tastiness of Candy Basket](https://leetcode.com/problems/maximum-tastiness-of-candy-basket/solutions/2947983/c-java-python-binary-search-and-sorting/)\n[Number of Flowers in Full Bloom](https://leetcode.com/problems/number-of-flowers-in-full-bloom/solutions/1976804/python3-2-lines-sort-and-binary-search/)
['C++', 'Java', 'Python3']