2025-08-15 13:43:07 +0000 UTC
Longer Contiguous Segments of Ones than Zeros
Categories:
Links
Code
class Solution:
def checkZeroOnes(self, s: str) -> bool:
max_length = [0, 0]
cur = 0
prev = -1
for char in s:
val = int(char)
if val == prev:
cur += 1
else:
cur = 1
if cur > max_length[val]:
max_length[val] = cur
prev = val
return max_length[1] > max_length[0]