Remove k consecutive elements from an array so that max minus min of the remaining elements is as small as possible.
Unlock detailed company stats for this questionUpgrade
Given an integer array and an integer k, remove exactly k consecutive elements so that the amplitude of what remains (its maximum minus its minimum) is as small as possible. Return that smallest amplitude.
Community answers
No answers contributed by the community yet.
Related questions
Given arrays A and B, build C with C[i] chosen from A[i] or B[i] so that the smallest missing positive integer of C is as small as possible, and return it.Given a sorted array of distinct positive integers and m, choose m elements so that the smallest gap between any two chosen elements is as large as possible, and return that gap.Find the K smallest elements of an array.Related courses

Course

