Question: can you solve this with dynamic programming: Question: There are 2 N people a company is planning to interview. The cost of flying the i
can you solve this with dynamic programming: Question: There are N people a company is planning to interview. The cost of flying the ith person to city A is costsi and the cost of flying the ith person to city B is costsi
Return the minimum cost to fly every person to a city such that exactly N people arrive in each city.
Input:
Output:
Explanation:
The first person goes to city A for a cost of
The second person goes to city A for a cost of
The third person goes to city B for a cost of
The fourth person goes to city B for a cost of
The total minimum cost is to have half the people interviewing in each city.
Note:
costs.length
It is guaranteed that costs.length is even.
costsi costsi
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
