The larger the first number, the lower it should be. After all, 4XXX is bigger than 3XXX.
setp? 1:? [0][ 1][2]
32 1
32
three
four
Ranked first? 0? Column, the bigger the row, the farther back.
ret? =? [? ,,,? 4]
setp? 2:? [0][ 1][2]
32 1
32
3? & lt3 & gt? & lt-? Make up the position? 3. Because? 3? Is it the same? 3? The first element of the group.
Ranked first? 1? Column, the bigger the row, the farther back.
ret? =? [? ,,? 3,? 4]
setp? 3:? [0][ 1][2]
32 1
32? & lt3 & gt& lt-? Make up the position? 3. Because? 3? Is it the same? 3? The first element of the group.
Ranked first? 2? Column, the bigger the row, the farther back. 323? Than? 32 1? It's big, so ...
ret? =? [? ,? 32,? 3,? 4]
There is only one left, and this is the most important thing:
ret? =? [32 1,? 32,? 3,? This is the basic idea. To sum up:
1. First group by [0] column:
2. Each number in the group is filled to the same length, and then sorted.
Complete code:
def? joinmin(ls):
Group? =? {}
For what? Articles? Are you online? ls:
Prefix? =? project
n? =? 0
What time? Prefix? & gt? 10:
Prefix? //=? 10
n? +=? 1
Groups.setdefault (prefix, []). Append ([item, n]).
Sort key? =? List (sorted (group))
ret? =? 0
For what? Prefix? Are you online? Sort keywords:
Articles? =? Group [prefix]
max_n? =? max([t[ 1]? For what? t? Are you online? Project])
Pre-sorting _ Project? =? []
For what? Item,? item_n? Are you online? Project:
Fill? =? project
n? =? Project _n
What time? max_n? & gt? n:
Fill? *=? 10
Fill? +=? prefix
n? +=? 1
Presort_items.append ((fill,? Item,? item_n))
For what? _,? Item,? n? Are you online? Sorted (pre-sorted items):
What time? n? & gt? - 1:
ret? *=? 10
n? -=? 1
ret? +=? project
Return? Ret didn't answer for you, but this little topic is quite interesting.