You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h2><ahref="https://leetcode.com/problems/split-with-minimum-sum">2650. Split With Minimum Sum</a></h2><h3>Easy</h3><hr><p>Given a positive integer <code>num</code>, split it into two non-negative integers <code>num1</code> and <code>num2</code> such that:</p>
2
+
3
+
<ul>
4
+
<li>The concatenation of <code>num1</code> and <code>num2</code> is a permutation of <code>num</code>.
5
+
6
+
<ul>
7
+
<li>In other words, the sum of the number of occurrences of each digit in <code>num1</code> and <code>num2</code> is equal to the number of occurrences of that digit in <code>num</code>.</li>
8
+
</ul>
9
+
</li>
10
+
<li><code>num1</code> and <code>num2</code> can contain leading zeros.</li>
11
+
</ul>
12
+
13
+
<p>Return <em>the <strong>minimum</strong> possible sum of</em> <code>num1</code> <em>and</em> <code>num2</code>.</p>
14
+
15
+
<p><strong>Notes:</strong></p>
16
+
17
+
<ul>
18
+
<li>It is guaranteed that <code>num</code> does not contain any leading zeros.</li>
19
+
<li>The order of occurrence of the digits in <code>num1</code> and <code>num2</code> may differ from the order of occurrence of <code>num</code>.</li>
20
+
</ul>
21
+
22
+
<p> </p>
23
+
<p><strongclass="example">Example 1:</strong></p>
24
+
25
+
<pre>
26
+
<strong>Input:</strong> num = 4325
27
+
<strong>Output:</strong> 59
28
+
<strong>Explanation:</strong> We can split 4325 so that <code>num1 </code>is 24 and num2<code> is </code>35, giving a sum of 59. We can prove that 59 is indeed the minimal possible sum.
29
+
</pre>
30
+
31
+
<p><strongclass="example">Example 2:</strong></p>
32
+
33
+
<pre>
34
+
<strong>Input:</strong> num = 687
35
+
<strong>Output:</strong> 75
36
+
<strong>Explanation:</strong> We can split 687 so that <code>num1</code> is 68 and <code>num2 </code>is 7, which would give an optimal sum of 75.
37
+
</pre>
38
+
39
+
<p> </p>
40
+
<p><strong>Constraints:</strong></p>
41
+
42
+
<ul>
43
+
<li><code>10 <= num <= 10<sup>9</sup></code></li>
0 commit comments