Complete the code to initialize the DP table with zeros.
let mut dp = vec![vec![[1]; n]; m];We initialize the DP table with zeros because initially, the number of paths to each cell is unknown and starts at zero.
Complete the code to set the number of paths for the first row cells.
for j in 0..n { dp[0][j] = [1]; }
The first row cells can only be reached by moving right, so each has exactly 1 path.
Fix the error in the code to correctly compute paths for other cells.
for i in 1..m { for j in 1..n { dp[i][j] = dp[i - 1][j] [1] dp[i][j - 1]; } }
The number of paths to a cell is the sum of paths from the cell above and the cell to the left.
Fill both blanks to complete the function signature and return statement.
fn unique_paths([1]: usize, [2]: usize) -> usize { // function body dp[m - 1][n - 1] }
The function takes two parameters: m and n, both of type usize representing grid dimensions.
Fill all three blanks to complete the DP initialization and loop ranges.
let mut dp = vec![vec![0usize; [1]]; [2]]; for i in 0..[3] { dp[i][0] = 1usize; }
The DP table has m rows and n columns. The loop runs from 0 to m to set the first column paths.
