I’m struggling to work out the algorithm for the following problem.
I have N customers who have an amount of cash
I have N products that can be bought for cash
Each product can only be purchased one
What I want to do is calculate all of the different permutations that each customer can buy and then find the permutation that fits a criteria.
Some of my c# code:
`public class Customer
{
public string Name:
public int Cash:
}
public class Product
{
public string Name:
public int Cost:
}`
Any help would be appreciated.
I’ve attempted a few different solutions including trying to iterate over each product and attempting to assign it to the customer. A historic assignment is stored. But this doesn’t seem to be working in the way I thought.
ChickenSatay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.