Problem 1196 · Easy

How Many Apples Can You Put into the Basket

Choose as many apples as possible from a row without the total weight exceeding the basket limit, taking the lightest apples first. The visual sorts the weights and fills a basket bar until the next apple would overflow it.

Open the interactive visualisation