Search
⌘K

Leetcode 487. Max Consecutive Ones II

Given a binary array, find the maximum length of a contiguous subarray of 1s you can get by flipping at most one 0 to 1; this is typically solved with a sliding-window/two-pointer approach that maintains a window containing at most one zero.

Asked at:

Bloomberg

Bloomberg

Snapchat


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Late February, 2026

Bloomberg

Bloomberg

Senior

Late October, 2025

Snapchat

Senior

Your account is free and you can post anonymously if you choose.