Find the contiguous interval of at least K elements with the maximum sign-twisted sum.
Unlock detailed company stats for this questionUpgrade
Given an integer array A of performance changes over N intervals, find a non-empty contiguous interval [i..j] of size at least K maximizing the cumulative improvement, where the sum is computed as -1*A[i] + A[i+1] + ... + A[j]. Framed as analyzing an ML model's recommendation quality: positive values are improvements, negative values declines. The twist is that the first element of the selected interval is negated, and the interval must contain at least K elements.
Format · DSA round of an Applied Scientist loop.
Community answers
No answers contributed by the community yet.


