Search
⌘K

Leetcode 1784. Check if Binary String Has at Most One Segment of Ones

Check whether a binary string (guaranteed to start with '1') contains at most one contiguous run of '1's — equivalently, verify that the pattern '1...0...1' never occurs. Return true if all ones form a single segment, otherwise false.


Question Timeline

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

Comments

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