Tap here to switch tabs
Problem
Submissions

Problem: Subarray With Elements Greater Than Varying Threshold

med
30 min
Try to solve the Subarray With Elements Greater Than Varying Threshold problem.

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

med
30 min
Try to solve the Subarray With Elements Greater Than Varying Threshold problem.

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