Search⌘ K
AI Features

Two City Scheduling

Explore the two city scheduling problem where you must invite candidates equally to two locations while minimizing total cost. Understand how greedy algorithms help decide optimal assignments by comparing cost differences. This lesson improves your ability to solve balanced allocation problems efficiently and prepares you for related coding interview challenges.

Statement

A recruiter plans to hire n\textbf{\textit{n}} people and conducts their interviews at two different locations of the company. He evaluates the cost of inviting candidates to both these locations. The plan is to invite 50% at one location, and the rest at the other location, keeping costs to a minimum.

We are given an array, costs, where  ...