Houzz Interview Question

Greedy algorithm