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)/拆分数位后四位数字的最小和 [minimum-sum-of-four-digit-number-after-splitting-digits].html
2022-03-29 12:43:11 +08:00

34 lines
1.5 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>给你一个四位&nbsp;<strong></strong>&nbsp;整数&nbsp;<code>num</code>&nbsp;。请你使用 <code>num</code>&nbsp;中的 <strong>数位</strong> ,将&nbsp;<code>num</code>&nbsp;拆成两个新的整数&nbsp;<code>new1</code>&nbsp;&nbsp;<code>new2</code>&nbsp;<code>new1</code>&nbsp;<code>new2</code>&nbsp;中可以有&nbsp;<strong>前导 0</strong>&nbsp;,且&nbsp;<code>num</code>&nbsp;<strong>所有</strong>&nbsp;数位都必须使用。</p>
<ul>
<li>比方说,给你&nbsp;<code>num = 2932</code>&nbsp;,你拥有的数位包括:两个&nbsp;<code>2</code>&nbsp;,一个&nbsp;<code>9</code>&nbsp;和一个&nbsp;<code>3</code>&nbsp;。一些可能的&nbsp;<code>[new1, new2]</code>&nbsp;数对为&nbsp;<code>[22, 93]</code><code>[23, 92]</code><code>[223, 9]</code>&nbsp;<code>[2, 329]</code>&nbsp;</li>
</ul>
<p>请你返回可以得到的&nbsp;<code>new1</code>&nbsp;<code>new2</code>&nbsp;<strong>最小</strong>&nbsp;和。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><b>输入:</b>num = 2932
<b>输出:</b>52
<b>解释:</b>可行的 [new1, new2] 数对为 [29, 23] [223, 9] 等等。
最小和为数对 [29, 23] 的和29 + 23 = 52 。
</pre>
<p><strong>示例 2</strong></p>
<pre><b>输入:</b>num = 4009
<b>输出:</b>13
<b>解释:</b>可行的 [new1, new2] 数对为 [0, 49] [490, 0] 等等。
最小和为数对 [4, 9] 的和4 + 9 = 13 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1000 &lt;= num &lt;= 9999</code></li>
</ul>