The problem:
For anyone looking at this problem, here’s something that you should know about this problem. Although it’s not explicitly stated that I saw, the sample data implies that if an employee is in the office hometown, that person does not need to commute via a vehicle and can be excluded.
Other than that, it’s relatively simple. Create a list of employees with their hometown and commuter capacity, then just iterate through that list (sorted by commuter capacity) for each hometown. You should be able to either determine that minimum number of cars needed or that it’s impossible relatively quickly.
» Read more: Get to Work – March 2010