Hi, i am designing a Chinese auction website.
Tickets ($5, $10 & $20) are sold either individually, or via packages to receive discounts. There are various Ticket packages for example:
- 5-$5 tickets = receive 10% off
- 5-$10 tickets = receive 10% off
- 5-$20 tickets = receive 10% off
- 5-$5 tickets + 5-$10 tickets + 5-$20 tickets = receive 15% off
When users add tickets to their cart, i need to figure out the cheapest package(s) to give them. the trick is that if a user adds 4-$5 tickets + 5-$10 tickets + 5-$20 tickets, it should still give him package #3 since that would be the cheapest for him.
Any help in figuring out a algorithm to solve this, or any tips would be greatly appreciate it.
© Stack Overflow or respective owner