Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Find Sequence by saklar13
def count(list):
for i, l in enumerate(list[:len(list) - 3]):
if l == list[i+1] == list[i+2] == list[i+3]: return True
def checkio(matrix):
s = len(matrix)
if (any(count(row) for row in matrix) or
any(count([matrix[i][j] for i in range(s)]) for j in range(s)) or
any(count([matrix[a][j - a] for a in range(j + 1)]) for j in range(3, s)) or
any(count([matrix[i + a][s -1-a] for a in range(s -i)]) for i in range(s -3)) or
any(count([matrix[i + a][a] for a in range(s -i)]) for i in range(s -3)) or
any(count([matrix[a][j +a] for a in range(s -j)]) for j in range(s -3))): return True
return False
Jan. 5, 2015