Tap here to switch tabs
Problem
Submissions

Problem: How Many Apples Can You Put into the Basket

med
30 min
Try to solve the How Many Apples Can You Put into the Basket problem.

Statement

You are given a basket that can carry a maximum weight of 50005000 units and an integer array weight where each element represents the weight of an apple.

Return the maximum number of apples you can place into the basket such that their total weight does not exceed 50005000.

Constraints:

  • 1≤1 \leq weight.length ≤103\leq 10^3

  • 1≤1 \leq weight[i] ≤103\leq 10^3

⋮
Tap here to switch tabs
Problem
Submissions

Problem: How Many Apples Can You Put into the Basket

med
30 min
Try to solve the How Many Apples Can You Put into the Basket problem.

Statement

You are given a basket that can carry a maximum weight of 50005000 units and an integer array weight where each element represents the weight of an apple.

Return the maximum number of apples you can place into the basket such that their total weight does not exceed 50005000.

Constraints:

  • 1≤1 \leq weight.length ≤103\leq 10^3

  • 1≤1 \leq weight[i] ≤103\leq 10^3