Playing with the Knapsack Problem.
I wrote a blog post about it in Portuguese (BR): https://mazuhsoftwares.com/2024/06/18/problema-da-mochila-algoritmo-para-empacotar-itens-com-maior-valor-sem-exceder-o-peso/
And you can read more about it in English (written by someone else): https://www.geeksforgeeks.org/introduction-to-knapsack-problem-its-types-and-how-to-solve-them/