Coin problem, print all possible combination | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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?

24th Nov 2021, 6:19 PM
Jeanie Snow
Jeanie Snow - avatar
8 Answers
+ 3
Post your code on the playground and then post it here. Then everyone can see your try and help you fix it.
24th Nov 2021, 6:53 PM
Lebi
+ 2
Sorry about late reply. Your function will stop running when it gets a return.
26th Nov 2021, 12:15 PM
Lebi
+ 1
On line 10 I think you have to use continue. so: if pom < 0: continue else: ...
26th Nov 2021, 4:00 PM
Lebi
+ 1
Okey, I'll try it. Thanks
26th Nov 2021, 8:04 PM
Jeanie Snow
Jeanie Snow - avatar
0
Please elaborate the problem and the code. You could also post your code for help. Well, the current information is just insufficient.🙂
25th Nov 2021, 8:27 AM
NoBody
NoBody - avatar
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
26th Nov 2021, 10:34 AM
Jeanie Snow
Jeanie Snow - avatar
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.
26th Nov 2021, 1:47 PM
NoBody
NoBody - avatar
0
Thank you, I try it this way, but I probably need to think about it again. https://code.sololearn.com/cAOu0C3svIRS/?ref=app
26th Nov 2021, 3:50 PM
Jeanie Snow
Jeanie Snow - avatar