DEV Community

Discussion on: Understand The Algorithm Behind The Coin Change Problem With Mathematics

Collapse
 
appledevcanuck profile image
Apple Dev

Great walkthrough! One assumption to check: you equate “total ways to form X” with the integer partition problem, which assumes unlimited coins and order-agnostic combinations. But vending machines usually solve the min-coin variant, and some tasks count sequences (order matters). Could you clarify which variant you target and how your loop order ensures combinations (not permutations) and unlimited supply?

Collapse
 
ganesh-kumar profile image
Ganesh Kumar • Edited

Thank you for pointing out mistakes in my assumption.
My original goal was to understand how Integral Partition implemented in Computer.

I didn't know much about it's variant (min-coin variant) which vending machine use.

I have assumed permutation not permutation and also with unlimited supply of coins as I have done "coin change 2" variant under coin change.

I have Also made seperate post on understanding difference.
Please check it out:
dev.to/ganesh-kumar/the-difference...