Two City Scheduling with an Odd Candidate Count
Updated
Problem statement
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[][]) → longExamples
Example 1
costs = [[10,20],[30,200],[400,50],[30,20]]return = 110Send 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 = 50Because 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 = 7The 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 Phone Screen questions
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- 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
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026
- Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
Similar questions at other companies
- Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
- Maximum Number of Events That Can Be AttendedByteDance · PHONE SCREENByteDance interview questions
- Minimum Station Tracks for a Train ScheduleBNSF Railway · ONSITE INTERVIEWBNSF Railway interview questions
- Remove the Fewest Magic BeansThe D.E. Shaw Group · PHONE SCREENThe D.E. Shaw Group interview questions
- Aggressive CowsAmazon · PHONE SCREEN
- Unit-Weight Knapsack with Limited QuantitiesGoogle · ONSITE INTERVIEWGoogle interview questions
- Minimize Range After Three ChangesDRW · PHONE SCREENDRW interview questions
- Reduce Array Size to At Most HalfMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Maximize Monsters DefeatedSalesforce · ONSITE INTERVIEWSalesforce interview questions
- Maximize Workday EarningsCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions