Problem · Binary Search

Minimum Memory for Hard Drives

Learn this problem
MediumAmazonNEW GRADOA
See Amazon hiring insights

Problem statement

The general meaning of the question is as described. I will follow up in detail once I find reliable sources.

The second question is about distributing games to N children. There are m games in total, and the memory size of each game is stored in an array. You need to prepare N hard drives to distribute the games to the children. The requirement is that each child must receive at least one game, and all games must be distributed. The question asks: What is the minimum memory capacity required for each of the N hard drives?

Function

minimumMemory(games: int[], N: int) → int

Examples

Example 1

games = [6, 7, 10, 12, 1]N = 3return = 13

The minimum memory for each hard drive would be 13.

Constraints

🍇🍇

More Amazon problems

drafts saved locally
public int minimumMemory(int[] games, int N) {
  // write your code here
}
games[6, 7, 10, 12, 1]
N3
expected13
checking account