Longest Window With a Bounded Spread
Asked at Uber · Coding Questions · Difficulty: Medium · Last asked May 15, 2026
You are given a sequence of integer readings and a tolerance `limit`. Find the longest stretch of consecutive readings whose values all lie within `limit` of each other, and return its length. In other words, the largest value in the stretch minus the smallest value in it must be at most `limit`.
Loading the problem…