Question bank › Dynamic Programming
Dsa Dynamic Programming Warm-up

Maximum Count of Consecutive Ones

Given a binary array `nums`, find the maximum count of consecutive `1`s in the array. You can flip at most one `0` to `1`. Input format: - A single line containing space-separated integers, either `0` or `1`. Output format: - A single integer, the maximum count of consecutive `1`s after flipping at most one `0`. Example: Input: 1 0 1 1 0 Output: 4

Key concepts

dynamic_programmingbinarysubsequence

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.