Write a program to find the best two items. It takes two inputs:
- A filename with a list of sorted prices
- The balance of your gift card If no two items have a sum that is less than or equal to the balance on the gift card, print “Not possible”. You don’t have to return every possible pair that is under the balance, just one such pair.
The complexity of the solution is
The following algorithm will achieve complexity solution:
- Itearte on each item and substract it from the list of items
- run the algorithem on the remaining items and the amount in the card minus the price of the item that was substracted
- choose the set of 3 items from the previous step that their sum is the closest to the amount in the card (the 3 items that their value is the lowest).