We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1965803 commit a8bdcb8Copy full SHA for a8bdcb8
algorithms/cpp/uniquePaths/uniquePaths.II.cpp
@@ -31,14 +31,10 @@ using namespace std;
31
32
//As same as DP solution with "Unique Path I", just need to consider the obstacles.
33
int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {
34
-
35
- int row =obstacleGrid.size();
36
- int col = obstacleGrid[0].size();
37
vector<vector<unsigned int>> v (row, vector<unsigned int>(col, 0));
38
39
unsigned int max=0;
40
- for (int i=0; i<row; i++){
41
- for (int j=0; j<col; j++){
+ for (int i=0; i<obstacleGrid.size();; i++){
+ for (int j=0; j<obstacleGrid[0].size();; j++){
42
if(obstacleGrid[i][j] == 1){
43
max = v[i][j] = 0;
44
} else {
0 commit comments