ProgrammingModerate
On a 5 x 5 grid the number of cells on its boundary (first and last row, first and last column) is what?
- A. 20
- B. 16
- C. 12
- D. 9
Correct answer: B. 16
A 5 x 5 grid has 25 cells, and the 3 x 3 interior has 9, so 25 - 9 = 16 boundary cells.
More C Programming questions
- Which 2 x 2 product gives the top-left entry of A = [[1, 2], [3, 4]] times B = [[5, 6], [7, 8]]?
- A 3 x 3 grid has one blocked cell at row 1, column 1. How many right-or-down paths lead from the top-left to the bottom-right cell?
- The zigzag scan of the 3 x 3 matrix [[1,2,3],[4,5,6],[7,8,9]] along anti-diagonals, alternating direction (as in JPEG order), gives which…
- In the 3 x 3 matrix [[1,2,3],[4,5,6],[7,8,9]], what is the sum of the boundary cells, leaving the centre out?
- For a 4 x 4 matrix with a[i][j] = 4i + j, what is the sum of the anti-diagonal cells (i, 3 - i)?
- Using a largest-square DP on grid rows [1,0,1,1], [1,1,1,1], [1,1,1,0], what is the side of the largest all-ones square?