DP, O(n) TC
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def numberOfUniqueGoodSubsequences(self, binary: str) -> int:\n        n = len(binary)\n        # tab[i][j] contains the number of unique subsequences of suffix[i:]\n        # such that the first letter of subsequence is \'j\'\n        tab = [[0, 0] for i in range(n)]\n        ans = 0 if \'0\' not in set(binary) else 1\n        for i in range(n-1, -1, -1):\n            res = 0\n            if binary[i] != \'0\':\n                res += tab[i+1][0] if i < n-1 else 0\n                tab[i][0] = tab[i+1][0] if i < n-1 else 0\n                res += 1\n                tab[i][1] = (tab[i+1][1] if i < n-1 else 0) + res\n                ans += res\n            else:\n                res += tab[i+1][1] if i < n-1 else 0\n                tab[i][1] = tab[i+1][1] if i < n-1 else 0\n                res += 1\n                tab[i][0] = (tab[i+1][0] if i < n-1 else 0) + res\n        return ans % (10**9 + 7)\n```
['Python3']