Algorithms and Data Structures · Middle · Question 44 of 75

What is the complexity of the coin change DP for amount A and k coin types?

Explanation

For each amount from 1 to A you try each of the k coins once. Exponential O(kᴬ) is the brute-force recursion without caching.

Further reading

Problem with a question

Algorithms and Data Structures · Middle · question 44

Test yourself

Take the Algorithms and Data Structures · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz