CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes305downloads
1{2    "id": 2329,3    "name": "maximum_product_after_k_increments",4    "difficulty": "Medium",5    "link": "https://leetcode.com/problems/maximum-product-after-k-increments/",6    "date": "1648944000000",7    "task_description": "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 `109 + 7`. Note that you should maximize the product before taking the modulo. **Example 1:** ``` **Input:** nums = [0,4], k = 5 **Output:** 20 **Explanation:** Increment the first number 5 times. Now nums = [5, 4], with a product of 5 * 4 = 20. It can be shown that 20 is maximum product possible, so we return 20. Note that there may be other ways to increment nums to have the maximum product. ``` **Example 2:** ``` **Input:** nums = [6,3,3,2], k = 2 **Output:** 216 **Explanation:** Increment the second number 1 time and increment the fourth number 1 time. Now nums = [6, 4, 3, 3], with a product of 6 * 4 * 3 * 3 = 216. It can be shown that 216 is maximum product possible, so we return 216. Note that there may be other ways to increment nums to have the maximum product. ``` **Constraints:** `1 <= nums.length, k <= 105` `0 <= nums[i] <= 106`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "nums = [0,4], k = 5",12            "output": "20 "13        },14        {15            "label": "Example 2",16            "input": "nums = [6,3,3,2], k = 2",17            "output": "216 "18        }19    ],20    "private_test_cases": [],21    "haskell_template": "maximumProduct :: [Int] -> Int -> Int\nmaximumProduct nums k ",22    "ocaml_template": "let maximumProduct (nums: int list) (k: int) : int =  ",23    "scala_template": "def maximumProduct(nums: List[Int],k: Int): Int = { \n    \n}",24    "java_template": "public static int maximumProduct(List<Integer> nums, int k) {\n\n}",25    "python_template": "class Solution(object):\n    def maximumProduct(self, nums, k):\n        \"\"\"\n        :type nums: List[int]\n        :type k: int\n        :rtype: int\n        \"\"\"\n        "26}