 Clean code & Hinglish Exp. | Binary Search + O(1) space | C++
IntuitionSamjho tumhare paas kuch mechanics hain aur har mechanic ki speed alag-alag hai. Ab tumhe yeh pata lagana hai ki "Sabhi cars ko repair karne mein sabse
# Intuition
Samjho tumhare paas kuch mechanics hain aur har mechanic ki speed alag-alag hai. Ab tumhe yeh pata lagana hai ki "Sabhi cars ko repair karne mein sabse kam time kitna lagega?"

# Trick
- Pehle minimum aur maximum time ka range set karo — maan lo left = 0 aur right = 1e14.
- Phir Binary Search lagake middle time (mid) nikaalo.
- Ab check karo ki iss mid time mein sab mechanics milkar saari cars repair kar sakte hain ya nahi.
   - Agar haan ➔ matlab aur kam time mein bhi ho sakta hai, toh right = mid karo.
   - Agar nahi ➔ matlab aur zyada time chahiye, toh left = mid + 1 karo.
- Jab Binary Search khatam hoga, tab right mein answer milega.

***[is_feasible()]() ka funda***

- Har mechanic dekhega ki woh diye gaye time (mid) mein kitni cars repair kar sakta hai.
- Sabka total count nikaalo, agar yeh cars ki requirement ke barabar ya zyada ho, toh yeh time feasible hai.
# Complexity
- Time complexity: O(n log T)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(constant)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public: 
bool is_feasible(vector<int>&ranks, int cars, long long current_time){
    long long car = 0;
    for(auto rank: ranks){
        car += sqrt(current_time/rank);
    }
    return car>=cars;
}
    long long repairCars(vector<int>& ranks, int cars) {
        long long left = 0, right  = 1e14;

        while(left<right){
            long long mid = left + (right-left)/2;
            if(is_feasible(ranks, cars, mid)){
                right = mid;
            } else{
                left =mid+1;
            }
        }
        return right;
    }
};
```
['Array', 'Binary Search', 'Python', 'C++', 'Python3']