Greedy Algorithms8 sections · 316 units
Open in Course

Problem - Minimum Cost to Hire K Workers

Wage ratios

You want to hire exactly kk workers. Each worker has a quality and a minimum wage expectation. Workers must be paid proportionally to their quality and at least their minimum wage.

Find the minimum cost. The problem combines sorting by ratio with heap-based selection. The ratio wage[i]/quality[i]wage[i]/quality[i] determines how "expensive" a worker is per unit of quality.