Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
What if you think in a greedy approach?
The best apple to take in one step is the one with the smallest weight.
Sort the array and take apples with smaller weight first.