Python DP without split - O(N) O(1)
\nclass Solution:\n    def numberOfUniqueGoodSubsequences(self, binary: str) -> int:\n        \'\'\'\n        DP: \n        dp[i] := number of unique good subse
```\nclass Solution:\n    def numberOfUniqueGoodSubsequences(self, binary: str) -> int:\n        \'\'\'\n        DP: \n        dp[i] := number of unique good subseq of binary[:i+1] \n            including empty one\n        1) dp[i+1] = dp[i] * 2\n        2) however, we need to remove duplicates caused by previous\n           same char, let the corresponding index be j. then we need\n           to remove dp[j-1] (similar to 940. Distinct Subsequences II)\n        3) also, we need to remove 0_ if we have 0 previously, this\n           this tracked by has0\n        4) however, there could be 1 overlap in 2) and 3) if we has 0 in\n           both s[:j] and s[:i] as \'0_\' is removed twice, as we need to \n           add 1 if prev_h0 == True\n        \'\'\'\n        dp = 1 # empty subseq\n        prev_cnt = {"1": (0, False), "0": (0, False)}\n        has0 = False\n        for i, char in enumerate(binary):\n            prev_c, prev_h0 = prev_cnt[char]\n            prev_cnt[char], dp = (dp, has0), dp * 2 - prev_c - has0 + prev_h0 \n            if char == \'0\':\n                has0 = True\n        return (dp - 1) % 1000000007\n```
[]