Question: Python 3 Question #7 Given an n x n 2D grid represented gridPathsobstaclesO to compute the by a 2D array of 1s and os, complete
Question #7 Given an n x n 2D grid represented gridPathsobstaclesO to compute the by a 2D array of 1s and os, complete the function 2 the top left corner (0, 0) to the bottom right corner (n-1, n-1).sells of the grio umber of possible paths when going through the grid have This is like the problem we Seen in class, except there is a restriction that you cannot move that contain a O. You're only allowed to move right or down or iab ls o For example, this grid has 4 possible paths: Below is the code we saw for grid withou provided since we don't care about the content of the gr oout the content of the cells (notice how we don't actually need a 2D array id). this problem when we were computing the paths through an n x n def gridPaths(r, c, n): return 1 return gridPaths(r 1, c) + gridPaths(r, c+1) + gridPathsCr + 1, c 1) def gridPathsObstacles(array): # complete this function # Hint: you might need a recursive helper here
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
