Given a certain number, how many multiples of three could you obtain with its digits?

Suposse that you have the number 362. The numbers that can be generated from it are:
```
362 ----> 3, 6, 2, 36, 63, 62, 26, 32, 23, 236, 263, 326, 362, 623, 632 
```
But only:

```3, 6, 36, 63``` are multiple of three.

We need a function that can receive a number ann may output in the following order:

- the amount of multiples

- the maximum multiple

Let's see a case the number has a the digit 0 and repeated digits:
```
6063 ----> 0, 3, 6, 30, 36, 60, 63, 66, 306, 360, 366, 603, 606, 630, 636, 660, 663, 3066, 3606, 3660, 6036, 6063, 6306, 6360, 6603, 6630
```
In this case the multiples of three will be all except 0

```
6063 ----> 3, 6, 30, 36, 60, 63, 66, 306, 360, 366, 603, 606, 630, 636, 660, 663, 3066, 3606, 3660, 6036, 6063, 6306, 6360, 6603, 6630
```

The cases above for the function:
```python
find_mult_3(362) == [4, 63]

find_mult_3(6063) == [25, 6630]
```
In Javascript ```findMult_3()```.
The function will receive only positive integers (num > 0), and you don't have to worry for validating the entries.

Features of the random tests:
```
Number of test = 100
1000 ≤ num ≤ 100000000
```
Enjoy it!!

Difficulty: EASY
Tags: Fundamentals

String algorithms

Combinatorics

Mathematics

Data structures
Skill types: Data structures

Starter code:
def find_mult_3(num):
	

Solutions:
from itertools import permutations

def find_mult_3(num):
	num_list = tuple(map(int, str(num)))
	poss = set()
	for i in range(1, len(num_list) + 1):
		poss |= set(permutations(num_list, i))
	res = set()
	for p in poss:
		if p[0] != 0 and sum(p) % 3 == 0:
			res.add(p)
	res = [sum((x * 10 ** n for (n, x) in enumerate(p[::-1]))) for p in res]
	return [len(res), max(res)]


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

def find_mult_3(n):
	(mul_count, digits) = (0, sorted(map(int, str(n))))
	for r in range(1, len(digits) + 1):
		for comb in sorted({c for c in combinations(digits, r) if not sum(c) % 3}):
			dig_count = Counter(comb)
			mul_count += (r - dig_count.get(0, 0)) * factorial(r) // reduce(mul, map(factorial, dig_count.values()), r)
	return [mul_count, int(''.join(map(str, comb[::-1])))]


from itertools import permutations

def find_mult_3(num):
	ls = []
	for i in range(1, len(str(num)) + 1):
		for j in set(permutations(str(num), i)):
			ls.append(int(''.join(j)))
	ls = set(ls)
	solve = [x for x in ls if x != 0 and x % 3 == 0]
	return [len(solve), max(solve)]


from itertools import combinations, permutations

def find_mult_3(num):
	n = [int(c) for c in str(num)]
	r = set()
	for i in range(1, len(n) + 1):
		for c in combinations(n, i):
			if sum(c) % 3 == 0:
				r |= set([int(''.join([str(i) for i in p])) for p in permutations(c) if p[0] != 0])
	return [len(r), max(r)]


from itertools import permutations

def find_mult_3(s):
	x = []
	for i in range(1, len(str(s)) + 1):
		x += [int(''.join(p)) for p in list(set(permutations(str(s), i))) if not int(''.join(p)) % 3 and p[0] != '0']
	return [len(x), max(x)]


from itertools import permutations

def find_mult_3(num):
	st = str(num)
	val = [int(''.join(i)) for j in range(1, len(st) + 1) for i in set(permutations(st, j)) if int(''.join(i)) > 0 and int(''.join(i)) % 3 == 0]
	return [len(set(val)), max(val)]


import itertools

def find_mult_3(num):
	total = 0
	_max = float('-inf')
	for lst in get_combos(num):
		for i in lst:
			if i[0] != '0':
				number = int(''.join(i))
				if number % 3 == 0:
					total += 1
					if number > _max:
						_max = number
	return [total, _max]

def get_combos(num):
	return [set(itertools.permutations(str(num), i)) for i in range(1, len(str(num)) + 1)]


from functools import reduce

def num_to_arr(num):
	s = str(num)
	arr = [0] * 10
	for c in s:
		arr[int(c)] += 1
	return arr

def dist_digits(arr):
	dist = []
	for i in range(0, 10):
		if arr[i] > 0:
			dist.append(i)
	return dist

def all_combos(arr, m):
	combos = []
	if m == 1:
		for i in range(1, 10):
			if arr[i] > 0:
				combos.append([i])
		return combos
	if m > sum(arr):
		return []
	digits = dist_digits(arr)
	for d in digits:
		nextArr = [0] * 10
		for i in range(0, 10):
			if i == d:
				nextArr[i] = arr[i] - 1
			if i > d:
				nextArr[i] = arr[i]
		nextCombos = all_combos(nextArr, m - 1)
		for nextComb in nextCombos:
			nextComb.append(d)
		combos.extend(nextCombos)
	return combos

def complete_combos(arr):
	combos = []
	for i in range(1, len(arr)):
		combos.extend(all_combos(arr, i))
	return list([arr for arr in combos if sum(arr) % 3 == 0])

def fact(n, zeros=0):
	if n == 0:
		return 1
	if n == 1:
		return 1
	return (n - zeros) * fact(n - 1)

def permus(combo):
	arr = [0] * 10
	for digit in combo:
		arr[digit] += 1
	duplicates = 1
	for i in range(0, 10):
		if arr[i] > 1:
			duplicates *= fact(arr[i])
	return fact(len(combo), zeros=arr[0]) // duplicates

def find_mult_3(num):
	comp_combos = complete_combos(num_to_arr(num))
	return [sum(map(permus, comp_combos)), reduce(lambda x, y: x * 10 + y, comp_combos[-1])]