Algorithm · Capital One · Medium
You are given an integer grid matrix and a side length frameSize. A frame is any square block of frameSize × frameSize contiguous cells taken from matrix. The border of a frame is made up of the cells in its top row, its bottom row, its leftmost column and its rightmost column, where each corner cell is counted only one time. Process the grid as follows: For each possible frame, add up the values on its border. Identify all frames whose border sum equals the largest border…