1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/子串能表示从 1 到 N 数字的二进制串 [binary-string-with-substrings-representing-1-to-n].html
2022-03-29 12:43:11 +08:00

30 lines
950 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给定一个二进制字符串&nbsp;<code>s</code>&nbsp;和一个正整数&nbsp;<code>n</code>,如果对于&nbsp;<code>[1, n]</code>&nbsp;范围内的每个整数,<em>其二进制表示都是&nbsp;<code>s</code><strong>子字符串</strong> ,就返回 <code>true</code>,否则返回 <code>false</code>&nbsp;</em></p>
<p><strong>子字符串</strong>&nbsp;是字符串中连续的字符序列。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>s = "0110", n = 3
<strong>输出:</strong>true
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>s = "0110", n = 4
<strong>输出:</strong>false
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= s.length &lt;= 1000</code></li>
<li><code>s[i]</code>&nbsp;不是&nbsp;<code>'0'</code>&nbsp;就是&nbsp;<code>'1'</code></li>
<li><code>1 &lt;= n &lt;= 10<sup>9</sup></code></li>
</ul>