Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Pattern Recognition by Pactp
def checkio(pattern, image):
p_height, p_width = len(pattern),len(pattern[0])
i_height, i_width = len(image),len(image[0])
for r in range(i_height - p_height + 1):
for c in range(i_width - p_width + 1):
if all(image[r+i][c:c+p_width] == pattern[i]
for i in range(p_height)):
for p_r in range(p_height):
for p_c in range(p_width):
image[r + p_r][c + p_c] += 2
return image
April 17, 2023