|
| 1 | +<h2><a href="https://leetcode.com/problems/minimum-sum-of-four-digit-number-after-splitting-digits/">2160. Minimum Sum of Four Digit Number After Splitting Digits</a></h2><h3>Easy</h3><hr><p>You are given a <strong>positive</strong> integer <code>num</code> consisting of exactly four digits. Split <code>num</code> into two new integers <code>new1</code> and <code>new2</code> by using the <strong>digits</strong> found in <code>num</code>. <strong>Leading zeros</strong> are allowed in <code>new1</code> and <code>new2</code>, and <strong>all</strong> the digits found in <code>num</code> must be used.</p> |
| 2 | + |
| 3 | +<ul> |
| 4 | + <li>For example, given <code>num = 2932</code>, you have the following digits: two <code>2</code>'s, one <code>9</code> and one <code>3</code>. Some of the possible pairs <code>[new1, new2]</code> are <code>[22, 93]</code>, <code>[23, 92]</code>, <code>[223, 9]</code> and <code>[2, 329]</code>.</li> |
| 5 | +</ul> |
| 6 | + |
| 7 | +<p>Return <em>the <strong>minimum</strong> possible sum of </em><code>new1</code><em> and </em><code>new2</code>.</p> |
| 8 | + |
| 9 | +<p> </p> |
| 10 | +<p><strong class="example">Example 1:</strong></p> |
| 11 | + |
| 12 | +<pre> |
| 13 | +<strong>Input:</strong> num = 2932 |
| 14 | +<strong>Output:</strong> 52 |
| 15 | +<strong>Explanation:</strong> Some possible pairs [new1, new2] are [29, 23], [223, 9], etc. |
| 16 | +The minimum sum can be obtained by the pair [29, 23]: 29 + 23 = 52. |
| 17 | +</pre> |
| 18 | + |
| 19 | +<p><strong class="example">Example 2:</strong></p> |
| 20 | + |
| 21 | +<pre> |
| 22 | +<strong>Input:</strong> num = 4009 |
| 23 | +<strong>Output:</strong> 13 |
| 24 | +<strong>Explanation:</strong> Some possible pairs [new1, new2] are [0, 49], [490, 0], etc. |
| 25 | +The minimum sum can be obtained by the pair [4, 9]: 4 + 9 = 13. |
| 26 | +</pre> |
| 27 | + |
| 28 | +<p> </p> |
| 29 | +<p><strong>Constraints:</strong></p> |
| 30 | + |
| 31 | +<ul> |
| 32 | + <li><code>1000 <= num <= 9999</code></li> |
| 33 | +</ul> |
0 commit comments