Skip to content

Commit a8bdcb8

Browse files
ehdshaoel
authored andcommitted
fix uniquePaths.II cpp solution
1 parent 1965803 commit a8bdcb8

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

algorithms/cpp/uniquePaths/uniquePaths.II.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,10 @@ using namespace std;
3131

3232
//As same as DP solution with "Unique Path I", just need to consider the obstacles.
3333
int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {
34-
35-
int row =obstacleGrid.size();
36-
int col = obstacleGrid[0].size();
3734
vector<vector<unsigned int>> v (row, vector<unsigned int>(col, 0));
38-
3935
unsigned int max=0;
40-
for (int i=0; i<row; i++){
41-
for (int j=0; j<col; j++){
36+
for (int i=0; i<obstacleGrid.size();; i++){
37+
for (int j=0; j<obstacleGrid[0].size();; j++){
4238
if(obstacleGrid[i][j] == 1){
4339
max = v[i][j] = 0;
4440
} else {

0 commit comments

Comments
 (0)