Practice Subarray With Elements Greater Than Varying Threshold
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Subarray With Elements Greater Than Varying Threshold
Problem Statement
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.
Source: Subarray With Elements Greater Than Varying Threshold on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [1,3,4,3,1], threshold = 6
3
# Example 2
nums = [6,5,6,5,8], threshold = 7
1
Constraints
Related LeetCode Problems
Practice more problems similar to Subarray With Elements Greater Than Varying Threshold.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.