Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Pattern Recognition by Moff
def checkio(pattern, matrix):
ph, pw = len(pattern), len(pattern[0])
mh, mw = len(matrix), len(matrix[0])
for i in range(mh - ph + 1):
for j in range(mw - pw + 1):
if [row[j:j+pw] for row in matrix[i:i+ph]] == pattern:
for ii in range(i, i + ph):
for jj in range(j, j + pw):
matrix[ii][jj] += 2
return matrix
Aug. 8, 2015