Python O(n) Runtime O(1) Space DP Solution with Explanation
\nclass Solution:\n    def numberOfUniqueGoodSubsequences(self, binary: str) -> int:\n        # Go through right to left, consider index i in binary\n        # 
```\nclass Solution:\n    def numberOfUniqueGoodSubsequences(self, binary: str) -> int:\n        # Go through right to left, consider index i in binary\n        # Maintain sequences that end with 0 or 1\n        # if val at index i is 0, the new endZero at i is prev endZero + endOne.\n        # Can\'t make new sequence with this 0\n        # if val at index i is 1, the new endOne at i is prev endZero + endOne + 1 \n        # Can start new sequence here as well\n        \n        endZero, endOne = 0, 0\n        hasOne = False\n        \n        for val in binary:\n            if val == \'0\':\n                hasOne = True\n                endZero = endZero + endOne\n            else:\n                endOne = endZero + endOne + 1\n                    \n        return (endZero + endOne + hasOne) % (10**9+7)\n```
[]