Simple binary search java
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: nlog(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public boolean fun(int ranks[],int cars,long t){\n        long a=0;\n        for(int i:ranks){\n            a+=Math.sqrt(t/i);\n        }\n        if(a>=cars) return true;\n        return false;\n    }\n    public long repairCars(int[] ranks, int cars) {\n        long min=ranks[0];\n        for(int i:ranks){\n            min=Math.min(min,i);\n        }\n        long h=min*cars*cars;\n        long l=1;\n        long ans=h;\n        while(l<h){\n            long mid=(l+h)/2;\n            if(fun(ranks,cars,mid)){\n                h=mid;\n                ans=mid;\n            }\n            else{\n                l=mid+1;\n            }\n        }\n        return ans;\n    }\n}\n```
['Binary Search', 'Java']