1869. Longer Contiguous Segments of Ones than Zeros
https://leetcode.com/problems/longer-contiguous-segments-of-ones-than-zeros
Description
Given a binary string s
, return true
if the longest contiguous segment of 1
's is strictly longer than the longest contiguous segment of 0
's in s
, or return false
otherwise.
For example, in
s = "110100010"
the longest continuous segment of1
s has length2
, and the longest continuous segment of0
s has length3
.
Note that if there are no 0
's, then the longest continuous segment of 0
's is considered to have a length 0
. The same applies if there is no 1
's.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= s.length <= 100
s[i]
is either'0'
or'1'
.
ac
Last updated