Leetcode Note: Go - Check if Binary String Has at Most One Segment of Ones
Check if Binary String Has at Most One Segment of Ones - LeetCode
https://leetcode.com/problems/check-if-binary-string-has-at-most-one-segment-of-ones/
- Go 言語で取り組んだメモ
回答
[ C / C++ / Python / Java / Go / C# / JS / Ruby / Kotlin / Scala / Rust] Simple One-Liner - Check if Binary String Has at Most One Segment of Ones - LeetCode
https://leetcode.com/problems/check-if-binary-string-has-at-most-one-segment-of-ones/solutions/1428062/c-c-python-java-go-c-js-ruby-kotlin-scala-rust-simple-one-liner/
func checkOnesSegment(s string) bool {
return !strings.Contains(s, "01")
}