Leetcode coin change-II problem

Jyothi
Mar 12, 2024

Below is the problem:

This problem is similar to the coin change problem. The time complexity and space complexity are also the same. Here, we store the number of combinations instead of the minimum possible coin combination.

We have the same approaches here:

  • The brute force approach is where the recursive function make two calls. So the time complexity is 2^amount
  • Memoization approach where we define the 2D array where the number of rows = number of coins +1 and number of columns can be the amount+1
  • tabulation approach: Here we can optimize to the 1D array with size as the amount+1

My Solution: https://leetcode.com/problems/coin-change-ii/solutions/4862509/tabulation-and-memoization-approaches-using-python-with-o-amount-space-complexity/

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response