Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Brute force :) solution in Clear category for Bigger Together by ddavidse
from typing import List
import itertools
def bigger_together(ints: List[int]) -> int:
numbers = []
for permutation in itertools.permutations(ints):
ints1 = [str(x) for x in permutation]
number1 = ''.join(ints1)
number2 = int(number1)
numbers.append(number2)
return max(numbers) - min(numbers)
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert bigger_together([1,2,3,4]) == 3087, "4321 - 1234"
assert bigger_together([1,2,3,4, 11, 12]) == 32099877, "43212111 - 11112234"
assert bigger_together([0, 1]) == 9, "10 - 01"
assert bigger_together([100]) == 0, "100 - 100"
print('Done! I feel like you good enough to click Check')
Nov. 28, 2020