Tap here to switch tabs
Problem
Submissions

Problem: Split With Minimum Sum

med
30 min
Try to solve the Split With Minimum Sum problem.

Statement

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 num1 and num2 can contain leading zeros.

Constraints:

  • 10≤10 \leq num ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Split With Minimum Sum

med
30 min
Try to solve the Split With Minimum Sum problem.

Statement

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 num1 and num2 can contain leading zeros.

Constraints:

  • 10≤10 \leq num ≤109\leq 10^9