Computer Science, asked by logeshr22, 6 hours ago


Given a numerical array with n values from 0 to 9, find the smallest possible sum S (represented as a string) of two numbers created using the digits of the array eleme
numbers together should include all the digits of the array



Read the input from STDIN and print the output to STDOUT You should not write any arbitrary strings while reading the input or while printing, as these contribute to the standard output



Constraints:
Array size n should be greater than one
Array elements should be greater than or equal to zero



Input Format:
1) The first line of input contains the array size n.
11) The second line of input contains n elements separated by a single white space



Output Format:
A single line of output contains S.


Sample Input:
6
68 5423


Sample Output:
604


Explanation 1:
Two numbers of sizes (n/2) and (n-n/2) should be created using digits of the array such that their addition should form the smallest possible number. So the two numbers fu
and 246 to generate the smallest sum of 604 in the output.
Sample Input 2:
5 3 0 7 4
Sample Output 2:
82

Answers

Answered by piyushmalav85
0

Answer:

https://onlinegdb.com/HA6yW0VRM

Explanation:

logic here to generate the num1 from array values at even index and number2 from array value at odd index

Than just add these two numbers to get the minimum sum

Similar questions