Kotlin || Binary Search || O(N * log(N))
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

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

# Code
```kotlin []
class Solution {
    private fun verify(ranks: IntArray, cars: Int, time: Long): Boolean {
        var total = 0L
        for (r in ranks) {
            val c = sqrt((time / r).toDouble()).toInt()
            total += c
        }
        return total >= cars
    }

    fun repairCars(ranks: IntArray, cars: Int): Long {
        var l = 1L
        var r = ranks.max().toLong() * cars * cars
        while (l < r) {
            val m = (l + r) / 2
            if (verify(ranks, cars, m)) {
                r = m
            } else {
                l = m + 1
            }
        }
        return l
    }
}
```
['Binary Search', 'Kotlin']