max1
and max0
to store the maximum lengths of contiguous 1
s and 0
s, and count1
and count0
to count the current lengths of contiguous 1
s and 0
s.s
.
'1'
, increment count1
and reset count0
to zero.'0'
, increment count0
and reset count1
to zero.max1
with the maximum of max1
and count1
.max0
with the maximum of max0
and count0
.max1
and max0
.
max1
is greater than max0
, return true
.false
.