Earliest Longest Bounded-Adjacent Subarray
Updated
Problem statement
A contiguous subarray qualifies when every adjacent absolute difference is at most difference.
Return inclusive [start,end] indices of a maximum-length qualifying subarray, breaking ties by earliest start.
Function
longestBoundedAdjacentSubarray(numbers: int[], difference: int) → int[]Examples
Example 1
numbers = [-1,4,6,2,8,4,7]difference = 5return = [0,3]The earliest maximum qualifying run is returned.
Example 2
numbers = [1,10,2,11]difference = 3return = [0,0]The earliest maximum qualifying run is returned.
Constraints
1 <= numbers.length <= 1000000 <= difference <= 2000000000
More ZipRecruiter Online Assessment questions
- Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
- Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
- Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
- Minimum Changes to Draw a YOA · Seen Oct 2024
- Apply Binary State OperationsOA · Seen Sep 2024
- Simulate Orchard Rot SpreadOA · Seen Sep 2024
- Compare Odd- and Even-Index SumsOA · Seen Sep 2024
- Coordinate Removals with Column GravityOA · Seen Sep 2024
- Lexicographically Smallest End ReversalOA · Seen Sep 2024
- Recursively Expanded Shell Command CountsOA · Seen Sep 2024
Similar questions at other companies
- Count Strictly Increasing Contiguous WindowsIBM · OAIBM interview questions
- Count Good TuplesMatroid · OA
- Find Sliding-Window Pattern Start IndicesVisa · OAVisa interview questions
- Minimum Parking Roof LengthAmerican Express · OAAmerican Express interview questions
- Threshold AlertsGoldman Sachs · OAGoldman Sachs interview questions
- Maximum Events in a 60-Second WindowMarshall Wace · OAMarshall Wace interview questions
- Maximum Value of L (For off-campus 2025 batch hiring :)Uber · OAUber interview questions
- Optimizing Resource AllocationDell Technologies · OADell Technologies interview questions
- Count Increasing Stock PeriodsExpedia · OAExpedia interview questions
- Reduce Memory UsageAmazon · OA