โ† OYO questions

Longest subarray of 1s with one swap

Filed under OYO

Given a binary array, find the length of the longest subarray containing only 1s that can be obtained by swapping at most one 0 with a 1 from outside the current subarray.

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 OYO questions

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