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.

You are given an integer array nums of length n and an integer k.
Define the range of a subarray as:
Return the length of the shortest non-empty contiguous subarray whose range is at least k.
If no such subarray exists, return -1.
nums
: array of integers (can include negatives)
k
: non-negative integer
-1
if none exists.
1 <= n <= 2 * 10^5
-10^9 <= nums[i] <= 10^9
0 <= k <= 10^9
nums = [1, 3, 2], k = 2
→ answer
2
(subarray
[1,3]
has range
2
)
nums = [5, 5, 5], k = 1
→ answer
-1