So I am trying to design an algorithm to calculate the specific items I can buy, based on the amount of money I have, to get the most value of the purchase, given that each item has specific value. So my plan was to use nested if else statements etc… But that is extremely inefficient. Any input?
I am not asking for anyone to solve this for me. I am simply asking if this way is one of the least efficient but still successful way of doing it.
It sounds like you’re trying to implement the Knapsack problem.
You can read about it here: