Check if Binary String Has at Most One Segment of Ones LeetCode solution in JavaScript
Algorithms
JavaScript
Check if Binary String Has at Most One Segment of Ones
1
v
a
r
checkOnesSegment
=
function
(
s
)
{
2
return
s
.
indexOf
(
"01"
)
==
-
1
;
3
}
;
0
WPM
•
0
•
0
100%
ACC
•
0
•
0
0s
TIME
•
0