Tap here to switch tabs
Problem
Submissions

Problem: Subarray With Elements Greater Than Varying Threshold

Subarray With Elements Greater Than Varying Threshold asks for the length of a nonempty contiguous subarray where every value is greater than the threshold divided by its length, or -1 if none exists.

Statement

You are given an integer array nums and an integer threshold. Return the size k of any non empty contiguous subarray such that every element in that subarray is strictly greater than threshold / k.

If no such subarray exists, return −1-1.

Note: If multiple subarrays satisfy the condition, you may return the size of any one of them.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i], threshold ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Subarray With Elements Greater Than Varying Threshold

Subarray With Elements Greater Than Varying Threshold asks for the length of a nonempty contiguous subarray where every value is greater than the threshold divided by its length, or -1 if none exists.

Statement

You are given an integer array nums and an integer threshold. Return the size k of any non empty contiguous subarray such that every element in that subarray is strictly greater than threshold / k.

If no such subarray exists, return −1-1.

Note: If multiple subarrays satisfy the condition, you may return the size of any one of them.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i], threshold ≤109\leq 10^9