Solution

ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2021/functional-programming-design-and-analysis-of-algorithms-resit/8/a/solution

For denominations and target , greedy selects , using three coins. The representation uses two coins and is optimal because there is no denomination six. Hence choosing the largest affordable coin is not generally optimal.

New to topics? Read the docs here!