Greedy Algorithms8 sections · 316 units
Open in Course

Lessons from Lemonade

Resource flexibility

core idea: when you have multiple ways to achieve the same result, prefer using the less flexible resource. 1.1. 55 bills are flexible (help with 1010 and 2020 customers)

2.2. 1010 bills are inflexible (only help with 2020 customers)

3.3. Greedy choice: spend inflexible resources first. This pattern appears in many problems: when allocating resources, save the versatile ones for later. This principle applies beyond currency: in scheduling, resource allocation, and task assignment. Preserve flexibility whenever possible.