1987. Number of Unique Good Subsequences.cpp
Code\n\nclass Solution {\npublic:\n    int numberOfUniqueGoodSubsequences(string binary) {\n        const int MOD = 1\'000\'000\'007; \n        long f0 = 0, f1 
**Code**\n```\nclass Solution {\npublic:\n    int numberOfUniqueGoodSubsequences(string binary) {\n        const int MOD = 1\'000\'000\'007; \n        long f0 = 0, f1 = 0; \n        for (auto& ch : binary) {\n            if (ch == \'0\') f0 = (f0 + f1) % MOD; \n            else f1 = (f0 + f1 + 1) % MOD; \n        }\n        return (f0 + f1 + (f0 || binary[0] == \'0\')) % MOD; \n    }\n};\n```
['C']