Dsa
Sliding Window
Easy
Max Consecutive 1s
Given a binary array, find the maximum number of consecutive 1s in the array. The input will be a sequence of 0s and 1s. Output the maximum count of consecutive 1s.
Example:
Input:
1 1 0 1 1 1
Output:
3
Key concepts
sliding_windowbinarymax
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now