Gusto Interview Question

Thrifty algorithm