Find shortest subarray with range ≥ k
Company: Meta
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Overview: This question evaluates proficiency with array algorithms and range-query reasoning, testing understanding of max/min behavior over contiguous subarrays and use of appropriate data-structure techniques; it belongs to the Coding & Algorithms domain.
Read the full Meta Software Engineer interview experience this question came from
Constraints
- Inputs are provided as Python literals matching the function signature.
- Return a deterministic exact-match result.
Examples
Input: ([1,3,2], 2)
Expected Output: 2
Explanation: Prompt example.
Input: ([5,5,5], 1)
Expected Output: -1
Explanation: No qualifying range.
Hints
- Choose a representation that makes the core operation simple.
- Handle empty and boundary inputs before the main algorithm.