Evaluates algorithmic skills in cost-optimization, greedy reasoning and sorting-based assignment while requiring correct handling of constraints and edge cases. Commonly asked in the Coding & Algorithms domain to test a candidate’s ability to design and implement a concrete, implementation-level algorithm and reason about correctness and complexity.
You are scheduling candidates to attend an onsite interview. Each candidate i can fly to New York for cost c1[i] or to San Francisco for cost c2[i].
Constraint: You must send exactly ceil(n/2) candidates to New York, and the remaining candidates to San Francisco.
Task: Compute the minimum possible total travel cost.
Additionally, write a few unit-style test cases that validate your solution (including edge cases such as n=1 and odd n).