Hotel-Optimization using O(n^2) algorithm