Split With Minimum Sum Problem

Split With Minimum Sum Problem — ExecCode Easy DSA Practice

Solve the Split With Minimum Sum problem on ExecCode. Free online easy DSA practice in Math. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given a positive integer num, split it into two non-negative integers num1 and num2 such that:. Your task is to compute the required answer and return the minimum possible sum of num1 and num2. The concatenation of num1 and num2 is a permutation of num. In other words, the sum of the number of occurrences of each digit in num1 and num2 is equal to the number of occurrences of that digit in num. - num1 and num2 can contain leading zeros. Notes:.

Examples

Input {"num": 4325}; Output 59. Input {"num": 687}; Output 75

Constraints

10 <= num <= 10^9

Practice Split With Minimum Sum free on ExecCode. Browse DSA problems, topic map, and placement guides.