Tap here to switch tabs
Problem
Submissions

Problem: Apple Redistribution into Boxes

med
30 min
Try to solve the Apple Redistribution into Boxes problem.

Statement

You are given an array apple of size n and an array capacity of size m.

There are n packs of apples, where the ii-th pack contains apple[i] apples. There are also m boxes available, where the ii-th box can hold up to capacity[i] apples.

Return the minimum number of boxes needed to redistribute all the apples. Apples from the same pack can be split and placed into different boxes.

Constraints:

  • 1≤n==1 \leq n == apple.length ≤50\leq 50

  • 1≤m==1 \leq m == capacity.length ≤50\leq 50

  • 1≤1 \leq apple[i], capacity[i] ≤50\leq 50

  • The input is generated such that it is always possible to redistribute the packs of apples into the boxes.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Apple Redistribution into Boxes

med
30 min
Try to solve the Apple Redistribution into Boxes problem.

Statement

You are given an array apple of size n and an array capacity of size m.

There are n packs of apples, where the ii-th pack contains apple[i] apples. There are also m boxes available, where the ii-th box can hold up to capacity[i] apples.

Return the minimum number of boxes needed to redistribute all the apples. Apples from the same pack can be split and placed into different boxes.

Constraints:

  • 1≤n==1 \leq n == apple.length ≤50\leq 50

  • 1≤m==1 \leq m == capacity.length ≤50\leq 50

  • 1≤1 \leq apple[i], capacity[i] ≤50\leq 50

  • The input is generated such that it is always possible to redistribute the packs of apples into the boxes.