Skip to content

Practice Maximum Product After K Increments

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#2233
LeetCode Problem

Maximum Product After K Increments

Problem Statement

You are given an array of non-negative integers nums and an integer k. In one operation, you may choose any element from nums and increment it by 1. Return the maximum product of nums after at most k operations. Since the answer may be very large, return it modulo 10^9 + 7. Note that you should maximize the product before taking the modulo.

Source: Maximum Product After K Increments on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [0,4], k = 5
Output
20

# Example 2

Input
nums = [6,3,3,2], k = 2
Output
216

Constraints

1 <= nums.length, k <= 10^5
0 <= nums[i] <= 10^6

Related LeetCode Problems

Practice more problems similar to Maximum Product After K Increments.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.