← Questions
Longest subarray with absolute difference within a limit
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Given an integer array and a limit, return the length of the longest contiguous subarray in which any two elements differ by at most limit.
The expected answer is O(n): a sliding window that keeps the window's minimum and maximum in two monotonic deques.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding
