Uber | Phone | Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit

Anonymous User
297
Jan 21, 2022
Jan 21, 2022

Given an array of integers nums and an integer limit, return the size of the longest non-empty subarray such that the absolute difference between any two elements of this subarray is less than or equal to limit.

Example 1:

Input: nums = [8,2,4,7], limit = 4
Output: 2

https://leetcode.com/problems/longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit/

Comments (2)