Search Results

Search found 1 results on 1 pages for 'user76152'.

Page 1/1 | 1 

  • Find cheapest price for X number of days

    - by user76152
    Hey 'FLow. I have a technical challenge for you regarding an algorithm. Lets say 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 able to do now is: give me the best price from the list based on a number of days. So if ask for 3 days the best price from the list is from child one (1000) and two (1200), but there are of course different combinations you would have to try out at first. How would an algorithm that found the best price from this list look like ? Thank you!

    Read the article

1