Basic Java
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```\nclass Solution {\n    private static final int MOD = 1000000007;\n    public int numberOfUniqueGoodSubsequences(String binary) {\n\n        int n = binary.length();\n        int zeroCount = 0, oneCount = 0;\n        boolean hasZero = false;\n        \n        for (int i = 0; i < n; i++) {\n            char ch = binary.charAt(i);\n            if (ch == \'1\') {\n                oneCount = (zeroCount + oneCount + 1) % MOD;\n            } else {\n                zeroCount = (zeroCount + oneCount) % MOD;\n                hasZero = true;\n            }\n        }\n        \n        return (oneCount + zeroCount + (hasZero ? 1 : 0)) % MOD;\n    }\n}\n```
['Java']