FastPrepMinimize the Largest Part Beauty
Problems/Minimize the Largest Part Beauty

Minimize the Largest Part Beauty

Adobe logoAdobe● HardFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: Here an array is cut into k consecutive pieces, and the goal is the smallest possible worst piece score, where a piece scores its biggest value times its size. An Adobe Computer Scientist 1 report describes this as the coding task of its first round and rates it hard; the approach was accepted, although by the author's account the code never ran correctly in the interview. No limits or examples are given.

Our choices: values are positive integers up to 10^5, there are at most 1000 of them, k is between 1 and the array length, and the examples are new.

The judged task matches the report at about 90%.

Split the array nums into exactly k contiguous, non-empty parts. The beauty of a part is its largest value times its length.

Among all ways to split, return the smallest possible value of the largest beauty of a part.

Function

minMaxBeauty(nums: int[], k: int) → int

Examples

Example 1

nums = [3,1,4,1,5]k = 2return = 12

Split into [3, 1, 4] and [1, 5]: beauties 4 × 3 = 12 and 5 × 2 = 10, so the largest is 12. Other splits do worse, for example [3, 1] and [4, 1, 5] give 6 and 15. The answer is 12.

Example 2

nums = [2,2,2,2]k = 4return = 2

With 4 parts every part is one value: each beauty is 2.

Example 3

nums = [1,9,1]k = 1return = 27

One part holds everything: 9 × 3 = 27.

Constraints

  • 1 <= k <= nums.length <= 1000
  • 1 <= nums[i] <= 10^5

More Adobe problems

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
All Adobe interview questionsSee Adobe hiring insights
Saved
public int minMaxBeauty(int[] nums, int k) {
    // Write your code here.
}
Checking account…