0
Coin problem, print all possible combination
Hello. I can ask for help? I saw many videos and websites, which solving coin change problems. But I weren't able to find any of them, which would print possible combination for coin problems Like N = 9 Coin types = 1 6 7 Output. 7 1 1 6 1 1 1 1 1 1 1 1 1 1 1 1 1 Could someone please help me, please?
8 odpowiedzi
+ 3
Post your code on the playground and then post it here. Then everyone can see your try and help you fix it.
+ 2
Sorry about late reply. Your function will stop running when it gets a return.
+ 1
On line 10 I think you have to use continue.
so:
if pom < 0:
continue
else:
...
+ 1
Okey, I'll try it. Thanks
0
Please elaborate the problem and the code. You could also post your code for help.
Well, the current information is just insufficient.🙂
0
Okay. This is my code. But it's probably very wrong. But I don't know what to do anymore.
https://code.sololearn.com/cGWih440KYX6/?ref=app
0
It is Recursion. Using a function inside the same function with lower values with a final breakpoint.
Actually the real problem is that the function never returns a value. All it returns is either False or 'combination' array which is simply empty.
0
Thank you, I try it this way, but I probably need to think about it again.
https://code.sololearn.com/cAOu0C3svIRS/?ref=app