American Express interview question

check if another 2d array contains the same pattern