Tap here to switch tabs
Problem
Submissions

Problem: Minimum Capacity Box

Try to solve the Minimum Capacity Box problem.

Statement

You are given an integer array capacity, where capacity[i] represents the capacity of the iextthi^{ ext{th}} box, and an integer itemSize representing the size of an item.

A box can store the item if its capacity is greater than or equal to itemSize.

Return the index of the box with the minimum capacity that can store the item. If multiple boxes share this same minimum capacity, return the smallest index among them. If no box can store the item, return −1-1.

Constraints:

  • 1≤1 \leq capacity.length ≤100\leq 100

  • 1≤1 \leq capacity[i] ≤100\leq 100

  • 1≤1 \leq itemSize ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Capacity Box

Try to solve the Minimum Capacity Box problem.

Statement

You are given an integer array capacity, where capacity[i] represents the capacity of the iextthi^{ ext{th}} box, and an integer itemSize representing the size of an item.

A box can store the item if its capacity is greater than or equal to itemSize.

Return the index of the box with the minimum capacity that can store the item. If multiple boxes share this same minimum capacity, return the smallest index among them. If no box can store the item, return −1-1.

Constraints:

  • 1≤1 \leq capacity.length ≤100\leq 100

  • 1≤1 \leq capacity[i] ≤100\leq 100

  • 1≤1 \leq itemSize ≤100\leq 100