How does passing a key function let one greedy algorithm handle every definition of "best" in O(n log n) time?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
The Food class below is missing the body of density, which should return the food's value per unit of cost. Write it using the two getter methods (not the attributes directly), so it keeps working for any kind of cost. Complete density in the Food class.