Back to problems

Find an Exact Submatrix Pattern

Algorithm · Capital One · Medium

You are provided with two integer matrices: a larger matrix A having R rows and C columns, and a smaller matrix B having r rows and c columns. Decide whether B occurs as a contiguous rectangular block inside A. For the occurrence to be valid, every value in B must exactly match the corresponding value in A when the top‑left corner of B is placed at some position (i, j). No rotations, reflections, or skipping of cells are permitted. Formally, you must find integers i and j…

Checking your access…