Untitled
unknown
python
5 months ago
476 B
5
Indexable
def solution(digits): from itertools import combinations # Generate all possible combinations of up to 3 digits max_number = 0 for r in range(1, 4): # from 1 digit to 3 digits for combo in combinations(digits, r): # Convert tuple of digits to integer and check if it's the largest found so far num = int(''.join(map(str, combo))) if num > max_number: max_number = num return max_number
Editor is loading...
Leave a Comment