1987 python
\tclass Solution:\n\t\tdef numberOfUniqueGoodSubsequences(self, binary: str) -> int:\n\t\t\tans = 1\n\t\t\tif "0" in binary:\n\t\t\t\tans += 1\n\t\t\tmod = int(
\tclass Solution:\n\t\tdef numberOfUniqueGoodSubsequences(self, binary: str) -> int:\n\t\t\tans = 1\n\t\t\tif "0" in binary:\n\t\t\t\tans += 1\n\t\t\tmod = int(1e9+7)\n\t\t\tn = len(binary)\n\t\t\ti = 0\n\t\t\twhile i< n and binary[i] == "0":\n\t\t\t\ti+= 1\n\t\t\tif i == n:\n\t\t\t\treturn 1\n\t\t\tbinary = binary[i:]\n\t\t\ttrie = [1,1]\n\n\t\t\tfor i,v in enumerate(binary[1:]):\n\t\t\t\tval = int(v)\n\t\t\t\tif val == 0:\n\t\t\t\t\ttrie[1] += trie[0]\n\t\t\t\t\ttrie[1] %= mod\n\t\t\t\telse:\n\t\t\t\t\ttrie[0] += trie[1]\n\t\t\t\t\ttrie[0] %= mod\n\n\t\t\t\tans += trie[val]%mod\n\t\t\treturn ans%mod\n\n
['Dynamic Programming', 'Python']