Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Find Sequence solved solution in Clear category for Find Sequence by dominieq
def VerseSearch(matrix, height, length):
condition = False
for i in range(height):
for j in range(length):
counter = 0
while j + counter < length and matrix[i][j] == matrix [i][j+counter]:
counter = counter + 1
if counter > 3:
print(counter)
condition = True
return condition
def ColumnSearch(matrix, height, length):
condition = False
for i in range(length):
for j in range(height):
counter = 0
while j + counter < height and matrix[j][i] == matrix [j+counter][i]:
counter = counter + 1
if counter > 3:
condition = True
return condition
def DiagonalSearch(matrix, height, length):
condition = False
for i in range(height):
for j in range(length):
counter = 0
while i + counter < height and j - counter >= 0 and matrix[i][j] == matrix [i+counter][j-counter]:
counter = counter + 1
if counter > 3:
condition = True
for i in range(height):
for j in range(length-1,-1,-1):
counter = 0
while j + counter < length and i + counter < height and matrix[i][j] == matrix [i+counter][j+counter]:
counter = counter + 1
if counter > 3:
condition = True
return condition
def checkio(matrix):
first = VerseSearch(matrix, len(matrix), len(matrix[0]))
second = ColumnSearch(matrix, len(matrix), len(matrix[0]))
third = DiagonalSearch(matrix, len(matrix), len(matrix[0]))
print(first, second, third)
if first or second or third:
return True
else:
return False
Nov. 7, 2016