Skip to content

Commit 4858d40

Browse files
authored
Create check-if-binary-string-has-at-most-one-segment-of-ones.py
1 parent 6f21630 commit 4858d40

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Time: O(n)
2+
# Space: O(1)
3+
4+
class Solution(object):
5+
def checkOnesSegment(self, s):
6+
"""
7+
:type s: str
8+
:rtype: bool
9+
"""
10+
return "01" not in s

0 commit comments

Comments
 (0)