1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 15:31:43 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个二进制字符串&nbsp;<code>binary</code>&nbsp;。&nbsp;<code>binary</code>&nbsp;的一个 <strong>子序列</strong>&nbsp;如果是 <strong>非空</strong>&nbsp;的且没有 <b>前导</b>&nbsp;<strong>0</strong>&nbsp;(除非数字是 <code>\"0\"</code>&nbsp;本身),那么它就是一个 <strong>好</strong>&nbsp;的子序列。</p>\n\n<p>请你找到&nbsp;<code>binary</code>&nbsp;<strong>不同好子序列</strong>&nbsp;的数目。</p>\n\n<ul>\n\t<li>比方说,如果&nbsp;<code>binary = \"001\"</code>&nbsp;,那么所有 <strong>好</strong>&nbsp;子序列为&nbsp;<code>[\"0\", \"0\", \"1\"]</code>&nbsp;,所以 <b>不同</b>&nbsp;的好子序列为&nbsp;<code>\"0\"</code> 和&nbsp;<code>\"1\"</code>&nbsp;。 注意,子序列&nbsp;<code>\"00\"</code>&nbsp;<code>\"01\"</code>&nbsp;和&nbsp;<code>\"001\"</code>&nbsp;不是好的,因为它们有前导 0 。</li>\n</ul>\n\n<p>请你返回&nbsp;<code>binary</code>&nbsp;中&nbsp;<strong>不同好子序列</strong>&nbsp;的数目。由于答案可能很大,请将它对&nbsp;<code>10<sup>9</sup> + 7</code>&nbsp;<strong>取余</strong> 后返回。</p>\n\n<p>一个 <strong>子序列</strong>&nbsp;指的是从原数组中删除若干个(可以一个也不删除)元素后,不改变剩余元素顺序得到的序列。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><b>输入:</b>binary = \"001\"\n<b>输出:</b>2\n<b>解释:</b>好的二进制子序列为 [\"0\", \"0\", \"1\"] 。\n不同的好子序列为 \"0\" 和 \"1\" 。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><b>输入:</b>binary = \"11\"\n<b>输出:</b>2\n<b>解释:</b>好的二进制子序列为 [\"1\", \"1\", \"11\"] 。\n不同的好子序列为 \"1\" 和 \"11\" 。</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre><b>输入:</b>binary = \"101\"\n<b>输出:</b>5\n<b>解释:</b>好的二进制子序列为 [\"1\", \"0\", \"1\", \"10\", \"11\", \"101\"] 。\n不同的好子序列为 \"0\" \"1\" \"10\" \"11\" 和 \"101\" 。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= binary.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>binary</code>&nbsp;只含有&nbsp;<code>'0'</code>&nbsp;和&nbsp;<code>'1'</code> 。</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 28,
"likes": 30,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"1.7K\", \"totalSubmission\": \"3.5K\", \"totalAcceptedRaw\": 1713, \"totalSubmissionRaw\": 3542, \"acRate\": \"48.4%\"}",
"stats": "{\"totalAccepted\": \"1.8K\", \"totalSubmission\": \"3.6K\", \"totalAcceptedRaw\": 1755, \"totalSubmissionRaw\": 3616, \"acRate\": \"48.5%\"}",
"hints": [
"The number of unique good subsequences is equal to the number of unique decimal values there are for all possible subsequences.",
"Find the answer at each index based on the previous indexes' answers."