ProgrammingVery hard
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?
- A. 4
- B. 6
- C. 1
- D. 2
Correct answer: D. 2
Six paths exist without the block, and four of them pass through the centre. That leaves 2 paths.
More C Programming questions
- 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?
- A grid DP that counts right/down paths for 1000 x 1000 cells should use what memory layout to stay small?
- Which approach finds the maximum sum rectangle in an n x n int matrix with n = 500 within a second in C?