We’re preparing your current view and syncing the latest data.
Given two arrays denoting Alice's and Bob's costs to reach various buildings, find a building such that the sum of the distances both must travel is minimized. Return the building index with the minimum total cost. If multiple buildings have the same minimum cost, return the smallest building number.
Two arrays of integers, Alice's costs and Bob's costs, each representing costs to reach a building.
An integer representing the building index where Alice and Bob should meet.
The arrays are of equal length, length n, where 1 <= n <= 10^5. Costs are non-negative integers.
Example 1
Input
Alice = [1, 2, 3], Bob = [3, 2, 1]
Output
1
Explanation
At building index 1, total cost = 2 + 2 = 4, which is minimal.