For this int denominations[] = {1, 5, 10, 25}; vector<int> counts = getMaxCoins(50, 1, 0, 4, 2); code is showing wrong result Max wastage for $10 will be 4 not 3 ;)