gary@interview:~/interview/coding/696-count-binary….md$
$ cat ./coding/696-count-binary-substrings.md
[Coding]

696. Count Binary Substrings

────────────────────────────────────────────────────────────

696. Count Binary Substrings

class Solution:
    def countBinarySubstrings(self, s: str) -> int:
        groups = [1]
        for i in range(1, len(s)):
            if s[i-1] != s[i]:
                groups.append(1)
            else:
                groups[-1] += 1
        ans = 0
        for i in range(1, len(groups)):
            ans += min(groups[i-1], groups[i])
        return ans

--tags#String
$ ls ./coding/ | grep -v 696-count-binary-substrings
265. Paint House II256. Paint House143. Reorder List1762. Buildings With an Ocean View
← cd ../codingcd ~