Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Find Sequence by tokiojapan55
def check(numbers):
num = numbers[0]
len = 1
for n in numbers[1:]:
if num == n:
len += 1
if len >= 4:
return True
else:
len = 1
num = n
return False
def checkio(matrix):
#replace this for solution
width = len(matrix)
for n in range(width):
if check(matrix[n]):
return True
if check([matrix[m][n] for m in range(width)]):
return True
if check([matrix[n+m][m] for m in range(width-n)]):
return True
if check([matrix[m][n+m] for m in range(width-n)]):
return True
if check([matrix[n+m][width-m-1] for m in range(width-n)]):
return True
if check([matrix[m][width-n-m-1] for m in range(width-n)]):
return True
return False
June 23, 2020
Comments: