Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Creative category for Calculate Islands by panaro32
def checkio(m):
l = []
for x,y in [(i,j) for i in range(len(m)) for j in range(len(m[0])) if m[i][j]]:
c = [k for k,s in enumerate(l) if any(p in s for p in ((x,y-1),(x-1,y-1),(x-1,y),(x-1,y+1)))]
l.append([(x,y)]+sum(map(l.pop,reversed(c)),[]))
return sorted(map(len,l))
May 24, 2014