FastPrepEarliest Longest Bounded-Adjacent Subarray
Problems/Earliest Longest Bounded-Adjacent Subarray

Earliest Longest Bounded-Adjacent Subarray

ZipRecruiter logoZipRecruiter● EasyFULLTIMENEW GRADOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Two ZipRecruiter OA reports preserve bounded adjacent differences and maximum length; the stronger new-grad report fixes inclusive indices and earliest tie-breaking. One source lacks an employment label, so both NEW GRAD and FULLTIME are retained.

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 <= 100000
  • 0 <= 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

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public int[] longestBoundedAdjacentSubarray(int[] numbers, int difference) {
        // Write your code here.
    }

}
Checking account…