Problem · Math

Minimum Frames for Equal Chunks

Learn this problem
EasyThe D. E. Shaw GroupOA

Problem statement

You are given an array dataframes of positive integers. Each value represents the size of one dataframe.

For every dataframe, its final size must be divisible into at least two chunks of equal positive size. You may add frames to a dataframe. Return the minimum total number of frames that must be added across all dataframes.

The source sample shows that values already divisible into two equal chunks need no extra frames, while 1 and 5 each need one added frame.

Function

minimumFramesForEqualChunks(dataframes: int[]) → int

Examples

Example 1

dataframes = [1,6,8,2,5]return = 2

6, 8, and 2 can already be divided into two equal chunks. Add one frame to 1 and one frame to 5, so the answer is 2.

More The D. E. Shaw Group problems

drafts saved locally
public int minimumFramesForEqualChunks(int[] dataframes) {
  // write your code here
}
dataframes[1,6,8,2,5]
expected2
checking account