The Grid Search
Given a 2D array of digits, try to find the location of a given 2D pattern of digits.
Input Format
The first line contains an integer, T, which is the number of test cases.
T test cases follow, each having a structure as described below:
The first line contains two space-separated integers, R and C, indicating the number of rows and columns in the grid G, respectively.
This is followed by R lines, each with a string of C digits, which represent the grid G.
The following line contains two space-separated integers, r and c, indicating the number of rows and columns in the pattern grid P.
This is followed by r lines, each with a string of c digits, which represent the pattern P.
Output Format
Given a 2D array of digits, try to find the location of a given 2D pattern of digits.
Input Format
The first line contains an integer,
T, which is the number of test cases.
Ttest cases follow, each having a structure as described below:
The first line contains two space-separated integers,RandC, indicating the number of rows and columns in the gridG, respectively.This is followed by
Rlines, each with a string ofCdigits, which represent the gridG.The following line contains two space-separated integers,
randc, indicating the number of rows and columns in the pattern gridP.This is followed by
rlines, each with a string ofcdigits, which represent the patternP.Output Format
Display
YESorNO, depending on whether (or not) you find that the larger gridGcontains the rectangular patternP. The evaluation will be case sensitive.
Display YES or NO, depending on whether (or not) you find that the larger grid G contains the rectangular pattern P. The evaluation will be case sensitive.
My Code
Please provide any tips from efficiency to readability.
My Question
As a newbie programmer, especially in C++, any tips regarding my code would be much appreciated. This could be anything from code efficiency to readability.