Java DP
\nclass Solution {\n    int mod = (int) Math.pow(10,9)+7;\n    public int numberOfUniqueGoodSubsequences(String binary) {\n        if(!binary.contains("1")){\n 
```\nclass Solution {\n    int mod = (int) Math.pow(10,9)+7;\n    public int numberOfUniqueGoodSubsequences(String binary) {\n        if(!binary.contains("1")){\n            return 1;\n        }\n        int len = binary.length();\n        int[] last = new int[2];\n        Arrays.fill(last, -1);\n        long[] dp = new long[len];\n        int start = binary.indexOf(\'1\') + 1;\n        dp[start - 1] = 1;\n        for (int i = start; i < binary.length(); i++) {\n            int ch = Character.getNumericValue(binary.charAt(i));\n            dp[i] = 2 * dp[i - 1];\n            dp[i]%=mod;\n            if (last[ch] - 1 >= 0) {\n                dp[i] -= dp[last[ch] - 1];\n                dp[i]+=mod;\n                dp[i]%=mod;\n            }\n            last[ch] = i;\n        }\n        return (int) dp[len - 1] + (binary.contains("0") ? 1 : 0);\n    }\n}\n```
[]