We have an array with string digits that occurrs more than once, for example, ```arr = ['1', '2', '2', '2', '3', '3']```. How many different string numbers can be generated taking the 6 elements at a time?

We present the list of them below in an unsorted way:
``` 
['223213', '312322', '223312', '222133', '312223', '223321', '223231', '132223', '132322', '223132', '322321', '322312', '231322', '222313', '221233', '213322', '122323', '321322', '221332', '133222', '123232', '323221', '222331', '132232', '321232', '212323', '232213', '232132', '331222', '232312', '332212', '213223', '123322', '322231', '321223', '231232', '233221', '231223', '213232', '312232', '233122', '322132', '223123', '322123', '232231', '323122', '323212', '122233', '212233', '123223', '332221', '122332', '221323', '332122', '232123', '212332', '232321', '322213', '233212', '313222']
``` 
There are ```60``` different numbers and ```122233``` is the lowest one and ```332221``` the highest of all of them.

Given an array, ```arr```, with string digits (from '0' to '9'), you should give the exact amount of different numbers that may be generated with the lowest and highest value but both converted into integer values, using all the digits given in the array for each generated string number.

The function will be called as ```proc_arr()```.
```python
proc_arr(['1', '2', '2', '3', '2', '3']) == [60, 122233, 332221]
```

If the digit '0' is present in the given array will produce string numbers with leading zeroes, that will not be not taken in account when they are converted to integers.
```python
proc_arr(['1','2','3','0','5','1','1','3']) == [3360, 1112335, 53321110]
```
You will never receive an array with only one digit repeated n times.

Features of the random tests:
```
Low performance tests:
Number of tests: 100
Arrays of length between 6 and 10

Higher performance tests:
Number of tests: 100
Arrays of length between 30 and 100
```

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Data structures

Mathematics

Starter code: def proc_arr(arr):
	

Solutions:
from operator import mul
from math import factorial
from functools import reduce
from collections import Counter

def proc_arr(arr):
	s = ''.join(sorted(arr))
	return [factorial(len(arr)) // reduce(mul, list(map(factorial, list(Counter(arr).values())))), int(s), int(s[::-1])]


from math import factorial

def proc_arr(arr):
	arr = ''.join(sorted(arr))
	comb = factorial(len(arr))
	same = eval('*'.join(map(str, [factorial(arr.count(n)) for n in '0123456879'])))
	return [comb / same, int(arr), int(arr[::-1])]


from collections import Counter
from operator import floordiv
from functools import reduce
from math import factorial

def proc_arr(arr):
	count = reduce(floordiv, map(factorial, Counter(arr).values()), factorial(len(arr)))
	mini = int(''.join(sorted(arr)))
	maxi = int(''.join(sorted(arr, reverse=True)))
	return [count, mini, maxi]


from functools import reduce
from math import factorial as fac
from operator import mul

def proc_arr(lst):
	stg = ''.join(sorted(lst))
	p = fac(len(stg)) // reduce(mul, (fac(stg.count(d)) for d in set(stg)))
	return [p, int(stg), int(stg[::-1])]


from math import factorial as f
from functools import reduce as r
from operator import mul as m
from collections import Counter as C
proc_arr = lambda a: [f(len(a)) // r(m, map(f, C(a).values())), int(''.join(sorted(a, key=int))), int(''.join(sorted(a, key=int))[::-1])]


from collections import Counter
from math import factorial
from operator import mul
from functools import reduce

def proc_arr(arr):
	c = Counter(arr)
	xs = sorted(arr)
	n = factorial(len(arr)) // reduce(mul, list(map(factorial, list(c.values()))))
	return [n, int(''.join(xs)), int(''.join(xs[::-1]))]


from collections import Counter
from math import factorial

def proc_arr(arr):
	(perm, strng) = (factorial(len(arr)), [])
	for (k, v) in sorted(Counter(arr).items()):
		perm //= factorial(v)
		strng.append(k * v)
	return [perm, int(''.join(strng)), int(''.join(strng[::-1]))]


import math
from collections import Counter
from functools import reduce

def proc_arr(arr):
	arrstr = ''.join(sorted(arr, key=int))
	dupes = reduce(lambda x, y: x * y, [math.factorial(x[1]) for x in Counter(arr).most_common() if x[1] > 1] or [1])
	return [math.factorial(len(arr)) / dupes, int(arrstr), int(arrstr[::-1])]


from math import factorial
import re

def proc_arr(arr):
	s = ''.join(sorted(arr))
	r = ''.join(reversed(s))
	(low, high) = (int(s), int(r))
	digits = len(s)
	denominator = mul([factorial(end - start) for (start, end) in [m.span() for m in re.finditer('(?P<D>\\d)(?P=D)*', s)]])
	return [factorial(digits) // denominator, low, high]

def mul(coll):
	return 1 if not coll else coll[0] * mul(coll[1:])