Skip to content
U
uByte
Tutorials
🐹
Go
Beginner-friendly
🐍
Python
Clean & readable
🟨
JavaScript
Web & Node.js
☕
Java
Enterprise & OOP
🦀
Rust
Systems programming
⚙️
C++
Performance & control
💜
C#
.NET & game dev
Interview Prep
🎯
All problems
Browse every language
🐹
Go
🐍
Python
🟨
JavaScript
☕
Java
🦀
Rust
⚙️
C++
💜
C#
⚡
Daily challenge
One new problem every day
🎤
Interview simulator
Timed mock interview + AI debrief
💬
Interview experiences
Real stories shared anonymously
Certifications
📝
Certifications
Coding exams by language
🐹
Go
🐍
Python
🟨
JavaScript
☕
Java
🦀
Rust
⚙️
C++
💜
C#
U
uByte
// Max Consecutive Ones — EASY
// Category: array
Given a binary array `nums`, return the maximum number of consecutive `1`s in the array.
**Constraints:**
- `1 <= nums.length <= 10⁵`
- `nums[i]` is either `0` or `1`.
Example: nums = [1,1,0,1,1,1]
Output: 3
Max Consecutive Ones — Pro only
Sign up free to start solving problems. The daily challenge is always free — no account needed.
BEST VALUE
Yearly Pro
$49.99/year
Save $69.89 vs monthly
Monthly Pro
$9.99/month
Cancel anytime
Create free account →
Already have an account? Sign in
← Back to JavaScript problems