Back to problems

Minimum Length of Subarray with Min-Max Difference

Algorithm · Meta · Hard

Given an integer array and an integer k, determine the smallest subarray length for which the subarray's largest element minus its smallest element is at least k. Implement the function and include its time-complexity analysis. Also provide at least three test cases, where each array may contain up to 10^5 elements. Example

Checking your access…