✅C++ || DP
Code\n\nclass Solution {\npublic:\n    int uniquePathsWithObstacles(vector<vector<int>>& g) {\n        int n=g.size(),m=g[0].size();\n        vector<vector<int>
# Code\n```\nclass Solution {\npublic:\n    int uniquePathsWithObstacles(vector<vector<int>>& g) {\n        int n=g.size(),m=g[0].size();\n        vector<vector<int>>dp(n,vector<int>(m,0));\n        if(g[0][0])return 0;\n        dp[0][0]=1;\n        for(int i=1;i<n;i++){\n            if(g[i][0])dp[i][0]=0;\n            else dp[i][0]=dp[i-1][0];\n        }\n        for(int j=1;j<m;j++){\n            if(g[0][j])dp[0][j]=0;\n            else dp[0][j]=dp[0][j-1];\n        }\n        for(int i=1;i<n;i++){\n            for(int j=1;j<m;j++){\n                if(g[i][j])dp[i][j]=0;\n                else\n                dp[i][j]=dp[i-1][j]+dp[i][j-1];\n            }\n        }\n        return dp[n-1][m-1];\n    }\n};\n```\n![upvote (2).jpg](https://assets.leetcode.com/users/images/67f7a904-7321-42be-bd91-a472984d957a_1680787983.9002156.jpeg)\n
['Dynamic Programming', 'C++']