FPEvalRepoPublic/LeetCodeMetaData
0399
1{2 "id": 2419,3 "name": "subarray-with-elements-greater-than-varying-threshold",4 "difficulty": "Hard",5 "link": "https://leetcode.com/problems/subarray-with-elements-greater-than-varying-threshold/",6 "date": "2022-06-25",7 "task_description": "You are given an integer array `nums` and an integer `threshold`. Find any subarray of `nums` of length `k` such that **every** element in the subarray is **greater** than `threshold / k`. Return_ the **size** of **any** such subarray_. If there is no such subarray, return `-1`. A **subarray** is a contiguous non-empty sequence of elements within an array. **Example 1:** ``` **Input:** nums = [1,3,4,3,1], threshold = 6 **Output:** 3 **Explanation:** The subarray [3,4,3] has a size of 3, and every element is greater than 6 / 3 = 2. Note that this is the only valid subarray. ``` **Example 2:** ``` **Input:** nums = [6,5,6,5,8], threshold = 7 **Output:** 1 **Explanation:** The subarray [8] has a size of 1, and 8 > 7 / 1 = 7. So 1 is returned. Note that the subarray [6,5] has a size of 2, and every element is greater than 7 / 2 = 3.5. Similarly, the subarrays [6,5,6], [6,5,6,5], [6,5,6,5,8] also satisfy the given conditions. Therefore, 2, 3, 4, or 5 may also be returned. ``` **Constraints:** `1 <= nums.length <= 105` `1 <= nums[i], threshold <= 109`",8 "test_case": [9 {10 "label": "Example 1",11 "input": "nums = [1,3,4,3,1], threshold = 6",12 "output": "3 "13 },14 {15 "label": "Example 2",16 "input": "nums = [6,5,6,5,8], threshold = 7",17 "output": "1 "18 }19 ],20 "constraints": [21 "1 <= nums.length <= 105",22 "1 <= nums[i], threshold <= 109"23 ],24 "python_template": "class Solution(object):\n def validSubarraySize(self, nums, threshold):\n \"\"\"\n :type nums: List[int]\n :type threshold: int\n :rtype: int\n \"\"\"\n ",25 "java_template": "class Solution {\n public int validSubarraySize(int[] nums, int threshold) {\n \n }\n}",26 "metadata": {27 "func_name": "validSubarraySize"28 }29}