Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Find Sequence by Tinus_Trotyl
def checkio(matrix):
mx, my, strip = len(matrix[0]), len(matrix), (0, 1, 2)
for y in range(my):
for x in range(mx):
if x + 3 < mx and all(matrix[y][x+d] == matrix[y][x+d+1] for d in strip): return True
if y + 3 < my and all(matrix[y+d][x] == matrix[y+d+1][x] for d in strip): return True
if x + 3 < mx and y + 3 < mx:
if all(matrix[y+d][x+d] == matrix[y+d+1][x+d+1] for d in strip): return True
if all(matrix[y-d+3][x+d] == matrix[y-d+2][x+d+1] for d in strip): return True
return False
April 12, 2019