find the sum of maximum and minimum value in the stable numbers

0

0 votes
Medium
Problem


A number is stable if each digit occur the same number of times.i.e, the frequency of each digit in the number is the same. For e.g. 2277,4004,11,23,583835,1010 are examples for stable numbers.
Similarly, a number is unstable if the frequency of each digit in the number is NOT same. 

For e.g. 221,4314,101,233,58135,101 are examples of unstable numbers.
The output can be: Output=Maximum of all stable numbers + Minimum of all stable numbers

Time Limit: 10
Memory Limit: 256
Source Limit:
Explanation

Assuming that the five numbers are passed to a array as input1, input2, input3, input4, and input5,complete the function to find and return the output. OR
Read the input using array
For example: If input1=12, input2=1313, input3=122, input4=678, and input5=898
Stable numbers are 12,1313 and 678 
Unstable numbers are 122, and 898
So the output should be = Maximum of all stable numbers + Minimum of all stable numbers
= 1313+12=1325

Note: Read N value from the user.Based on the N value read input to the array
Input Format
Integer
Constraints
0<N<=100

0<a[i]<1000

Output Format
Integer

Sample:
Sample Input 0
5
12 1313 122 678 898

Sample Output 0
1325

Editor Image

?