[Python 3] Binary Search
The helper function repair(time) determines if cars can be repaired within time.\n\n# Code\n\nclass Solution:\n    def repairCars(self, ranks: List[int], cars: 
The helper function *repair(time)* determines if *cars* can be repaired within *time*.\n\n# Code\n```\nclass Solution:\n    def repairCars(self, ranks: List[int], cars: int) -> int:\n        lo,hi = 0,100*cars*cars\n        def repair(time):\n            n = cars\n            for r in ranks:\n                n -= floor(sqrt(time/r))\n                if n<=0:\n                    break\n            return n<=0\n        while lo<=hi:\n            m = (lo+hi)//2\n            if repair(m):\n                ans = m\n                hi = m-1\n            else:\n                lo = m+1\n        return ans\n```
['Binary Search', 'Python3']