Max Consecutive Ones
A easy-tier problem at 62% community acceptance, tagged with Array. Reported in interviews at Bloomberg and 5 others.
Max Consecutive Ones looks trivial on paper, but it's a screening filter at Bloomberg, Microsoft, and Google. You scan an array of 0s and 1s and return the longest run of consecutive 1s. The acceptance rate sits at 62%, which means roughly 1 in 3 candidates either misread the problem, mess up the loop logic, or overcomplicate it. If this hits your live OA and you blank on the state machine, StealthCoder surfaces a working solution in seconds, invisible to the proctor.
Companies that ask "Max Consecutive Ones"
Max Consecutive Ones is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop.
Get StealthCoderThe trap is overthinking. One pass through the array with a counter. When you see a 1, increment the counter. When you see a 0, compare the counter to a max and reset. Edge cases: all 1s (the array itself is the answer), all 0s (return 0), single element. Most candidates get it right but second-guess themselves into off-by-one errors or forget to compare the final counter after the loop ends. The algorithmic difficulty is zero; the failure mode is careless implementation. StealthCoder handles those off-by-one kills in real time during the assessment, so you can move forward confident.
Pattern tags
You know the problem.
Make sure you actually pass it.
Max Consecutive Ones recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Max Consecutive Ones interview FAQ
Is Max Consecutive Ones still asked at FAANG?+
Yes. Bloomberg, Microsoft, and Google report asking it. It's a common warm-up or screening problem. Don't expect it as a final-round question, but it can appear early in the funnel to filter out candidates who can't code cleanly under pressure.
What's the gotcha in Max Consecutive Ones?+
Forgetting to compare your counter to max after the loop. If the longest run is at the end, you need one final check outside the loop. Many candidates write the loop correctly but lose the point on that last edge case.
How does this problem relate to the Array topic?+
It's a linear scan with state tracking. You're not sorting, searching, or merging. You're reading left to right, maintaining a counter, and tracking a maximum. It teaches clean iteration and why you sometimes need a check after the loop closes.
Can I solve Max Consecutive Ones without extra space?+
Yes. You only need two variables: current count and max count. No hash maps, no extra arrays. If the interviewer asks about space complexity, say O(1) and explain your two-pointer approach.
Is Max Consecutive Ones a sign of a harder problem behind it?+
Sometimes. If it appears in a live assessment with multiple problems, expect harder array or string questions to follow. Getting this one fast buys you mental energy for the real challenge. Treat it as a freebie and move on in under 5 minutes.
Want the actual problem statement? View "Max Consecutive Ones" on LeetCode →