Tap here to switch tabs
Problem
Submissions

Problem: How Many Apples Can You Put into the Basket

How Many Apples Can You Put into the Basket gives you an array of apple weights and asks for the largest number you can carry without exceeding the basket's 5000-unit weight limit.

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

How Many Apples Can You Put into the Basket gives you an array of apple weights and asks for the largest number you can carry without exceeding the basket's 5000-unit weight limit.

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