← Visa questions

Longest Subarray with Absolute Difference of Adjacent Elements <= 1

Filed under Visa

Given an unsorted array of integers, find the length of the longest contiguous subarray such that when this subarray is sorted, the absolute difference between any two adjacent elements is less than…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Visa questions

Collected from public candidate posts and coding forums. Updated Nov 2026.