Created dynamic coin change algorithm