FastPrepFastPrep
Problem Brief

Determine Minimum Partitions Required

PHONE SCREEN

You were given a list of partitions and partitions used, determine the minimum amount of partitions required to fit all partitions. Data can be moved in chunks.

Function Description

Complete the function determineMinPartitionsRequired in the editor.

determineMinPartitionsRequired has the following parameters:

  1. 1. int[] partitions: an array of integers representing the size of each partition
  2. 2. int[] partitionsUsed: an array of integers representing the used space in each partition

Returns

int: the minimum number of partitions required

1Example 1

Input
partitions = [10, 15, 15, 20], partitionsUsed = [5, 10, 15, 5]
Output
2
Explanation

Explanation: 2 partitions of [15, 20] can accommodate [5, 10, 15, 5].

public int determineMinPartitionsRequired(int[] partitions, int[] partitionsUsed) {
  // write your code here
}
Input

partitions

[10, 15, 15, 20]

partitionsUsed

[5, 10, 15, 5]

Output

2

Sign in to submit your solution.