``` def find_min(arr): d={} res=[0]*len(arr) res[0]=arr[0] for i in range(1,len(arr)): if arr[i] in res[i-1]: if res[i-1].index(arr[i])==len(res[i-1])-1 or res[i-1][res[i-1].index(arr[i])+1]>res[i-1][res[i-1].index(arr[i])]: res[i]=res[i-1] else: res[i]=res[i-1][:res[i-1].index(arr[i])]+res[i-1][res[i-1].index(arr[i])+1:]+arr[i] else: res[i]=res[i-1]+arr[i] return int(res[-1]) ``` 菜鸡瞎写的。。
def find_min(arr):
res=[0]*len(arr)
res[0]=arr[0]
for i in range(1,len(arr)):
if arr[i] in res[i-1]:
if res[i-1].index(arr[i])==len(res[i-1])-1 or res[i-1][res[i-1].index(arr[i])+1]>res[i-1][res[i-1].index(arr[i])]:
res[i]=res[i-1]
else:
res[i]=res[i-1][:res[i-1].index(arr[i])]+res[i-1][res[i-1].index(arr[i])+1:]+arr[i]
else:
res[i]=res[i-1]+arr[i]
return int(res[-1])