FastPrepTwo City Scheduling with an Odd Candidate Count
Problems/Two City Scheduling with an Odd Candidate Count

Two City Scheduling with an Odd Candidate Count

Bloomberg LP logoBloomberg LP● MediumNEW GRADPHONE SCREENONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The source gives both city costs, the exact ceil(n/2) New York quota, and the minimum-total-cost objective, but omits numeric bounds and a callable signature. The judged task matches the visible core at about 98%.

Each row costs[i] = [newYorkCost, sanFranciscoCost] gives the travel cost for candidate i to attend an onsite interview in one of two cities.

Send exactly ceil(n / 2) candidates to New York and every remaining candidate to San Francisco. Return the minimum possible total travel cost.

Function

minimumTravelCost(costs: int[][]) → long

Examples

Example 1

costs = [[10,20],[30,200],[400,50],[30,20]]return = 110

Send the first two candidates to New York and the other two to San Francisco for 10 + 30 + 50 + 20 = 110.

Example 2

costs = [[10,100],[20,30],[30,20]]return = 50

Because n = 3, exactly two candidates go to New York. Sending the first two there and the third to San Francisco costs 10 + 20 + 20 = 50.

Example 3

costs = [[7,3]]return = 7

The New York quota is one, so the only candidate must go to New York even though San Francisco is cheaper.

Constraints

  • 1 <= costs.length <= 100000.
  • costs[i].length = 2.
  • 1 <= costs[i][j] <= 100000.

More Bloomberg LP problems

  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public long minimumTravelCost(int[][] costs) {
        // Write your code here.
    }

}
Checking account…