FPEvalDataset/LeetCodeProblem
0305
1{2 "id": 2601,3 "name": "number_of_great_partitions",4 "difficulty": "Hard",5 "link": "https://leetcode.com/problems/number-of-great-partitions/",6 "date": "1671321600000",7 "task_description": "You are given an array `nums` consisting of **positive** integers and an integer `k`. **Partition** the array into two ordered **groups** such that each element is in exactly **one** group. A partition is called great if the **sum** of elements of each group is greater than or equal to `k`. Return _the number of **distinct** great partitions_. Since the answer may be too large, return it **modulo** `109 + 7`. Two partitions are considered distinct if some element `nums[i]` is in different groups in the two partitions. **Example 1:** ``` **Input:** nums = [1,2,3,4], k = 4 **Output:** 6 **Explanation:** The great partitions are: ([1,2,3], [4]), ([1,3], [2,4]), ([1,4], [2,3]), ([2,3], [1,4]), ([2,4], [1,3]) and ([4], [1,2,3]). ``` **Example 2:** ``` **Input:** nums = [3,3,3], k = 4 **Output:** 0 **Explanation:** There are no great partitions for this array. ``` **Example 3:** ``` **Input:** nums = [6,6], k = 2 **Output:** 2 **Explanation:** We can either put nums[0] in the first partition or in the second partition. The great partitions will be ([6], [6]) and ([6], [6]). ``` **Constraints:** `1 <= nums.length, k <= 1000` `1 <= nums[i] <= 109`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "nums = [1,2,3,4], k = 4",12 "output": "6 "13 },14 {15 "label": "Example 2",16 "input": "nums = [3,3,3], k = 4",17 "output": "0 "18 },19 {20 "label": "Example 3",21 "input": "nums = [6,6], k = 2",22 "output": "2 "23 }24 ],25 "private_test_cases": [],26 "haskell_template": "countPartitions :: [Int] -> Int -> Int\ncountPartitions nums k ",27 "ocaml_template": "let countPartitions (nums: int list) (k: int) : int = ",28 "scala_template": "def countPartitions(nums: List[Int],k: Int): Int = { \n \n}",29 "java_template": "public static int countPartitions(List<Integer> nums, int k) {\n\n}",30 "python_template": "class Solution(object):\n def countPartitions(self, nums, k):\n \"\"\"\n :type nums: List[int]\n :type k: int\n :rtype: int\n \"\"\"\n "31}