## Problem Statement

During lunch time, a restaurant has N seats which can serve at most N customers simultaneously. Assume there are M customers i=1..M and each take exactly t[i] minutes to finish their lunch. What is the minimum time required to serve all customers?

## Solution

This is an NP-hard problem called partition problem. Almost every restaurant operator know how to solve this heuristically – just assign empty seat to customer in first-come-first-serve manner. But they may not aware that if they can assign seats optimally, they maybe possible to knock off a bit early.

Advertisements