Back to problems

Max Matrix Border Distinct Sum

Algorithm · Ebay · Medium

You are given a matrix of integers matrix with dimensions $$m \times n$$, and a positive integer frameSize. For each frameSize × frameSize square submatrix of the matrix, consider its outer border, which we call the frame. The frame consists of the top row, bottom row, left column, and right column of the square. Any cells that lie completely inside the square are not part of the frame. When frameSize = 1, the single cell is the frame. For each such square, calculate the sum…

Checking your access…