FastPrepFastPrep
Problem Brief

Minimize Effort with EffiBin Kit

NEW GRADFULLTIMEOA
See Amazon online assessment and hiring insights

Not entirely sure for NG or FT, so I label both. Will update find more reliable source! :P

With Amazon's new innovative EffiBin Kit users can effortlessly optimize the arrangement of their storage bins. This kit is designed to minimize the overall effort needed for efficient organization. The process starts with an array of bins, and the objective is to reduce the total effort required. The effort is the sum of efforts needed for each bin.

Formally, given an array effort of size n, utilizing the EffiBin Kit, users can perform operations on the array, in each operation, the user chooses two positions i and j, such that the effort of the bin at position i (effort[i]) is divisible by the effort of the bin at position j (effort[j]). When this condition is satisfied, the effort of bin i can be updated to equal the effort of bin j. This operation can be repeated as many times as possible, on different bins or positions.

An integer x is divisible by another integer y if x can be divided by y exactly, with nothing left over, for example, 6 is divisible by 3, while 7 is not.

Find the minimum total effort after applying some (possibly zero) number of operations.

๐“‚ƒ เฝผ๐“‚ƒMany Thanks to Spike!๐“‚ƒ ๐“ˆ’๐“ธ

1Example 1

Input
effort = [3, 6, 2, 5, 25]
Output
17
Explanation
Example 1 illustration

Constraints

Limits and guarantees your solution can rely on.

  • 1 <= n <= 2 * 105
  • 1 <= effort[i] <= 2 * 105
public int minimizeEffort(int[] effort) {
  // write your code here
}
Input

effort

[3, 6, 2, 5, 25]

Output

17

Sign in to submit your solution.