Last active
October 28, 2015 21:02
-
-
Save Grumblesaur/1e43e71cffcdd376664b to your computer and use it in GitHub Desktop.
Dropsort: Remove element of list if it is not at least as large as the maximum of the elements preceding it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def d(l): | |
j=b=0;m=l[j];r=[] | |
for i in l: | |
(m,b)=[(m,0),(i,1)][i>=m] | |
if b>0:r+=[i] | |
j+=1 | |
l[:]=r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment