InterviewDigestInterviewDigest

OA Practice Workspace

Technical2026-08-13

Medium question 3

AI-Expanded — inferred from the question title, not from the original candidate report

Given an array of integers, find the length of the longest subarray where the absolute difference between any two elements is no greater than one. Implement a function that returns this length in O(n) time complexity using an efficient sliding window or hash map approach.

Context & Summary

Online coding round with 4 questions of varying difficulty

💻 Coding practice works best on desktop.
Code editors are too cramped on mobile screens.