BINARY SEARCH || C++ || EASY TO UNDERSTAD
Code\n\nclass Solution {\npublic:\n    long long repairCars(vector<int>& ranks, int cars) {\n        long long int mn = 0, mx = 1e15, mid = 0;\n        long lon
# Code\n```\nclass Solution {\npublic:\n    long long repairCars(vector<int>& ranks, int cars) {\n        long long int mn = 0, mx = 1e15, mid = 0;\n        long long int ans,k=0;\n        while(mn<=mx){\n            mid = (mx-mn)/2+mn;\n            k = 0;\n            for(auto &i: ranks){\n                k += sqrt(mid/i);\n            }\n            if(k>=cars){\n                ans = mid;\n                mx = mid-1;\n            }else{\n                mn = mid+1;\n            }\n        }\n        return ans;\n    }\n};\n```
['Array', 'Binary Search', 'C++']