September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -1,16 +1,10 @@
|
|||
try:
|
||||
from itertools import zip_longest
|
||||
except:
|
||||
try:
|
||||
from itertools import izip_longest as zip_longest
|
||||
except:
|
||||
zip_longest = lambda *args: map(None, *args)
|
||||
#!/bin/python3
|
||||
from itertools import zip_longest
|
||||
|
||||
|
||||
def beadsort(l):
|
||||
return map(len, columns(columns([[1] * e for e in l])))
|
||||
return list(map(sum, zip_longest(*[[1] * e for e in l], fillvalue=0)))
|
||||
|
||||
def columns(l):
|
||||
return [filter(None, x) for x in zip_longest(*l)]
|
||||
|
||||
# Demonstration code:
|
||||
print(beadsort([5,3,1,7,4,1,1]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue