list1 = list(str(n))
list2 = sorted(list(str(n)), reverse= True)
i = 0
while i < len(list1):
if list1 >= list2:
i += 1
continue
else:
j = i+1
while j < len(list1):
if list1 < list2:
j += 1
continue
else:
temp = list1
list1 = list1
list1 = temp
return int(''.join(list1))
if i == len(list1) or j == len(list1):
return n from itertools import permutations
def fun311(x):
x = str(x)
combin_list = []
for i in permutations(x):
count = 0
for j in range(len(i)):
if x != i:
count += 1
if count > 2:
break
if count <= 2:
combin_list.append(int(''.join()))
return max(combin_list)
页:
1
[2]