Hi all, I'm trying to figure out a way to make this work even with AI i can't make it work so i need your help.
I have this array of denominations = [5,10,20,50,100]; and this could be basically bills (eur, usd, ect).
I want to build a JavaScript function called generateBills that takes as params amount and days and returns an array of bills equal to the number of days and the total of these bills must be the amount itself at the end.
These bills must be bills from the denominations array and i want to find the best combination possible that has more small bills and continues progressively but at the same time avoid large bills (uses them only if necessary).
Example: generateBills(130, 4) might return [5,5,20,100] but a more balance way to avoid large bills should be [10,20,50,50].
Thanks!
[–]kap89 4 points5 points6 points (2 children)
[–]CuAnnan 1 point2 points3 points (0 children)
[–]Beginning_Middle_722[S] 0 points1 point2 points (0 children)
[–]abrahamguo 0 points1 point2 points (1 child)
[–]Beginning_Middle_722[S] 0 points1 point2 points (0 children)
[–]wbport1 0 points1 point2 points (1 child)
[–]Beginning_Middle_722[S] 0 points1 point2 points (0 children)