Given a positive integer num, split all of its digits into two integers num1 and num2 such that:
The digits in num1 and num2 collectively form a permutation of the digits in num. In other words, every digit in num is assigned to either num1 or num2.
The sum of num1 and num2 is minimized.
Return the minimum possible sum of num1 and num2.
Note: Both
num1andnum2can contain leading zeros.
Constraints:
num
Given a positive integer num, split all of its digits into two integers num1 and num2 such that:
The digits in num1 and num2 collectively form a permutation of the digits in num. In other words, every digit in num is assigned to either num1 or num2.
The sum of num1 and num2 is minimized.
Return the minimum possible sum of num1 and num2.
Note: Both
num1andnum2can contain leading zeros.
Constraints:
num