I have a technical problem for you regarding the algorithm.
Suppose I have this list of days and prices:
List<ReservationPrice> prices = new List<ReservationPrice>();
prices.Add(new ReservationPrice { NumberOfDays = 1, Price = 1000 });
prices.Add(new ReservationPrice { NumberOfDays = 2, Price = 1200 });
prices.Add(new ReservationPrice { NumberOfDays = 3, Price = 2500 });
prices.Add(new ReservationPrice { NumberOfDays = 4, Price = 3100 });
prices.Add(new ReservationPrice { NumberOfDays = 7, Price = 4000 });
What I would like to do now is:
give me the best price from the list based on few days.
So, if you ask for 3 days, the best price from the list is from one child (1000) and two (1200), but, of course, there are different combinations that you will have to try first. What would be the algorithm that found the best price from this list?
Thank!
source
share