C++ Solution || DP || Recursion
\nclass Solution {\npublic:\n    int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {\n        int m = obstacleGrid.size(), n = obstacleGrid[0].siz
```\nclass Solution {\npublic:\n    int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {\n        int m = obstacleGrid.size(), n = obstacleGrid[0].size();\n        vector<vector<int>>dp(m, vector<int>(n, 0));\n        \n        //filling 0th row\n        for(int i = 0; i < n; i++){\n            if(obstacleGrid[0][i] == 1) break;\n            dp[0][i] = 1;\n        }\n        \n        //filling 0th column\n         for(int i = 0; i < m; i++){\n            if(obstacleGrid[i][0] == 1) break;\n            dp[i][0] = 1;\n        }\n        \n        //filling rest of the dp array\n        for(int i = 1; i < m; i++)\n            for(int j = 1; j < n; j++){\n                if(obstacleGrid[i][j] == 1) continue;\n                dp[i][j] = dp[i-1][j] + dp[i][j-1];\n            }\n        return dp[m-1][n-1];\n    }\n};\n```\n\n```\nclass Solution {\npublic:\n    int m, n;\n    vector<vector<int>>dp;\n    int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {\n        m = size(obstacleGrid), n = size(obstacleGrid[0]);\n        dp.resize(m, vector<int>(n));\n        return helper(obstacleGrid, 0, 0);\n    }\n    int helper(vector<vector<int>>& grid, int i, int j){\n        if(i < 0 || j < 0 || i >= m || j >= n) return 0;\n        if( grid[i][j]) return dp[i][j] = 0;\n        if(i == m-1 && j == n-1) return 1;\n        if(dp[i][j]) return dp[i][j];\n        return dp[i][j] = helper(grid, i, j+1) + helper(grid, i+1, j);\n    }\n};\n```
['Dynamic Programming', 'C', 'C++']