Hi Gene, my Idea works - the one 3 mail... when d1,d2, d3,...dr are sorted in non-decreasing order AND "di-1 mod di = 0 , for all 2< i < r.".
thats why in the begining of the logic, I mentioned for this specific problem ( as mentinoned in the table), denomincations hold the property - "di mod di-1 = 0 , for all 1< i < r.". but in the example given by you, 50,20 they are not multiples to each other... thanks, sudhakar. Gene wrote: > Your algorithm does not show how to select di. If you pick the > smallest possible denomination first, then consider S=6 with a cash box > of > 2 x 1 > 1 x 5 > The algorithm will pick both 1's and then fail because all that's left > is the 5. > > If you pick the largest possble di then try S=60 with a cash box of > 1 x 50 > 3 x 20 > This will take the 50 and then fail because there are no 10s.