[Python3] bit-mask dp
Please see this commit for solutions of weekly 256.\n\n\nclass Solution:\n    def numberOfUniqueGoodSubsequences(self, binary: str) -> int:\n        \n        @
Please see this [commit](https://github.com/gaosanyong/leetcode/commit/7abfd85d1a68e375fcc0be60558909fd98b270f3) for solutions of weekly 256.\n\n```\nclass Solution:\n    def numberOfUniqueGoodSubsequences(self, binary: str) -> int:\n        \n        @cache\n        def fn(i, mask, v): \n            """Return # unique good subsequences starting with 1."""\n            if i == len(binary) or not mask: return v\n            x = int(binary[i])\n            if not mask & (1<<x): return fn(i+1, mask, v)\n            return (fn(i+1, 3, 1) + fn(i+1, mask^(1<<x), v)) % 1_000_000_007\n        \n        return fn(0, 2, 0) + int("0" in binary)\n```\n\nA shorter dp \n```\nclass Solution:\n    def numberOfUniqueGoodSubsequences(self, binary: str) -> int:\n        f0 = f1 = 0\n        for ch in binary: \n            if ch == "0": f0 += f1\n            else: f1 += f0 + 1\n        return (f0 + f1 + int("0" in binary)) % 1_000_000_007\n```
['Python3']