O(n*m) C++ easy solution


#1
   int Solution::uniquePathsWithObstacles(vector<vector<int> > &A) {
        int n=A.size(),m=A[0].size();
        vector<vector<int>>dp(n,vector<int>(m,0));
        dp[0][0]=1;
        for(int i=0;i<n;i++)
            for(int j=0;j<m;j++){
                if(i==0 and j==0 or A[i][j]==1)continue;
                if(i!=0 and A[i-1][j]==0)dp[i][j]+=dp[i-1][j];
                if(j!=0 and A[i][j-1]==0)dp[i][j]+=dp[i][j-1];
            }
        if(A[n-1][m-1]==1)return 0;
        return dp[n-1][m-1];
    }