Accepted C++ ✔️  ||  Simple 3 Lines Explanation🏅  || time->O(NlogN)
\n\n\n# \u2714\uFE0F Approach\n## Intuition\n Describe your first thoughts on how to solve this problem. \n\n- Suppose that the answer is k minutes, then we che
\n\n\n# \u2714\uFE0F Approach\n## Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n- Suppose that the answer is k minutes, then we check if all the cars can be repaired in k minutes.\n- If it can be repaired in k minutes, then it is possibly an answer but we look to optimise it further.\n- If it cant be repaired in k minutes, we check for some greater value than k.\n- We use the Binary Search to do so.\n\n\n\n- ### Time complexity:  O(NlogN)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- ### Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n\ntypedef long long ll;\n\nclass Solution {\npublic:\n\n    // check if all the cars can be repaired in the t time\n    // OUTPUT -> True Or False \n    bool can_all_be_repaired(vector<int>& ranks, int cars, ll time){\n        // for every merchanic, we check how many cars he/she can repaired in given "time";\n        ll total_cars_repaired = 0;\n        int ranks_size = ranks.size();\n        for(int i=0; i<ranks_size; i++){\n            total_cars_repaired += (ll)sqrt(time/(ll)ranks[i]);\n            // cout << total_cars_repaired << " ";\n        }\n        // cout << endl;\n        return total_cars_repaired >= cars;\n\n    }\n\n    long long repairCars(vector<int>& ranks, int cars) {\n        \n        ll maxVal = 0;\n        int size = ranks.size();\n        for(int i=0; i<size; i++){\n            if(maxVal < ranks[i]){\n                maxVal = (ll) ranks[i];\n            }\n        }\n\n        // let assume the range to be [ 1 , maxVal* cars^2 ]\n        ll low = 1, high = maxVal*((ll)cars*(ll)cars);\n\n        while(low <= high){\n            ll mid = (low + high)>>1;\n\n            if(can_all_be_repaired(ranks, cars, mid)){\n                high = mid-1;\n            }else{\n                low = mid+1;\n            }\n        }\n        return high+1;\n        \n    }\n};\n \n\n```
['Binary Search', 'C++']