Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2018/functional-programming-design-and-analysis-of-algorithms/6/c/i/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2018 Functional programming, design and analysis of algorithms 6 c i Solution by
Codex 0 2026-10-31
Use a Boolean dynamic programming state for whether amount can be made exactly. Initialize and, for , computeAn empty disjunction is false. Any nonempty representation ends in some coin; removing it gives one of the displayed predecessor states, and adding it back proves the converse. Return . This takes time and space for positive integer denominations and nonnegative integer target , with unlimited coins of each type.
New to topics? Read the docs here!