left = 1.right = sum(batteries) / n.left < right, perform the following steps:
a. Calculate the middle value target = (left + right + 1) / 2.
b. Initialize extra to store the sum of usable power from all batteries.
c. Iterate over batteries and add min(batteries[i], target) to extra.
d. If extra >= n * target, set left = target. Otherwise, set right = target - 1.left as the maximum running time.