1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/划分数字的方案数 [number-of-ways-to-separate-numbers].html
2022-03-29 12:43:11 +08:00

44 lines
1.4 KiB
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>你写下了若干 <strong>正整数</strong>&nbsp;,并将它们连接成了一个字符串&nbsp;<code>num</code>&nbsp;。但是你忘记给这些数字之间加逗号了。你只记得这一列数字是 <strong>非递减</strong>&nbsp;的且&nbsp;<strong>没有</strong> 任何数字有前导 0 。</p>
<p>请你返回有多少种可能的 <strong>正整数数组</strong>&nbsp;可以得到字符串&nbsp;<code>num</code>&nbsp;。由于答案可能很大,将结果对 <code>10<sup>9</sup> + 7</code>&nbsp;<b>取余</b>&nbsp;后返回。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><b>输入:</b>num = "327"
<b>输出:</b>2
<b>解释:</b>以下为可能的方案:
3, 27
327
</pre>
<p><strong>示例 2</strong></p>
<pre><b>输入:</b>num = "094"
<b>输出:</b>0
<b>解释:</b>不能有数字有前导 0 ,且所有数字均为正数。
</pre>
<p><strong>示例 3</strong></p>
<pre><b>输入:</b>num = "0"
<b>输出:</b>0
<strong>解释:</strong>不能有数字有前导 0 ,且所有数字均为正数。
</pre>
<p><strong>示例 4</strong></p>
<pre><b>输入:</b>num = "9999999999999"
<b>输出:</b>101
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= num.length &lt;= 3500</code></li>
<li><code>num</code>&nbsp;只含有数字&nbsp;<code>'0'</code>&nbsp;<code>'9'</code>&nbsp;</li>
</ul>