Simple C++ solution|| Using two different Approaches
If you really found my solution helpful please upvote it, as it motivates me to post such kind of codes and help the coding community, if you have some queries 
**If you really found my solution helpful please upvote it, as it motivates me to post such kind of codes and help the coding community, if you have some queries or some improvements please feel free to comment and share your views.**\n//1st Approach\n//This will give TLE\n```\n//DFS+Backtracking\n    void dfs(int i,int j,int m,int n,int &cnt,vector<vector<int>> &vis,vector<vector<int>> obstacleGrid)\n    {\n        if(i>=m||j>=n)\n            return ;\n        if(obstacleGrid[i][j]==1||vis[i][j]==1)\n            return;\n        if(i==m-1&&j==n-1)\n            cnt++;\n        vis[i][j]=1;\n        dfs(i+1,j,m,n,cnt,vis,obstacleGrid);\n        dfs(i,j+1,m,n,cnt,vis,obstacleGrid);\n        vis[i][j]=0;\n    }\n    int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {\n        int cnt=0;\n        int m=obstacleGrid.size();\n        int n=obstacleGrid[0].size();\n        if(obstacleGrid[0][0]==1||obstacleGrid[m-1][n-1]==1)\n            return 0;\n        vector<vector<int>> vis(m,vector<int>(n,0));\n        dfs(0,0,m,n,cnt,vis,obstacleGrid);\n        return cnt;\n        }\n\t\t\n\t\t//Recursive+Memoization\n    int solve(int i,int j,int m,int n,vector<vector<int>> &dp,vector<vector<int>> &obstacleGrid)\n    {\n        if(i>=m||j>=n||obstacleGrid[i][j])\n            return 0;\n        if(i==m-1&&j==n-1)\n            return 1;\n        if(dp[i][j]!=-1)\n            return dp[i][j];\n        return dp[i][j]=solve(i+1,j,m,n,dp,obstacleGrid)+solve(i,j+1,m,n,dp,obstacleGrid);\n    }\n    int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {\n        int m=obstacleGrid.size();\n        int n=obstacleGrid[0].size();\n     vector<vector<int>> dp(m,vector<int>(n,-1));\n        return solve(0,0,m,n,dp,obstacleGrid);\n        }\n//TC:O(m*n)\n//SC:O(m*n)\n```\n
['Dynamic Programming', 'C', 'C++']