Pattern Search in Grid

Problem Statement Given a huge grid G with M rows and N columns and a pattern P with m rows and n columns. The task at hand is to perform a pattern search in grid, and print YES if the pattern grid P exists in the grid G otherwise print NO [caption id="attachment_3611" align="aligncenter" width="960"] Pattern Search in Grid[/caption] Its a simple string search but requires special attention to the boundary cases. Here is a list of them We only need to test the grid G for M-m rows, because anything below row R-r  cannot accommodate the pattern of size r. We only need to test the gr...
Read More