Grokking Dynamic Programming Patterns for Coding Interviews
Ask Author
Back to course home

0% completed

Vote For New Content
class Solution { public int coinChange(int[] coins, int amount) { if(a...

Avinash Agarwal

Apr 21, 2022

class Solution { public int coinChange(int[] coins, int amount) { if(amount == 0) return 0; if(coins.length == 0 && amount > 0) return -1;

int[] dp = new int[amount+1];

Arrays.fill(dp, amount+1); dp[0] = 0;

for(int i=1; i

0

0

Comments
Comments

On this page