Assuming that there are n tyres that could be used by a car,tricycle and a bicycle. I need to write an algorithm to accept n-tyres and generate all d possible combinations of car(s), tricycle(s) and bicycle(s) that will exhaust the n-tyres.
For example:
Since cars need 4 tyres, tricycles need 3 tyres and bicycles need 2 tyres, the all the possible combinations to EXHAUST 10 tyres are listed below:
2 Cars and 1 Bicycle
1 Car and 3 Bicycles
1 Car and 2 Tricycles
2 Tricycles and 2 Bicycle
5 Bicycles.
These are all the combinations possible for car, tricycle and bicycle to exhaust 10 tyres.
Please can you help me with the code in any language (preferably in C#) that can generate the combinations above for n-tyres.
Thanks