```
class Solution {
public:
int uniquePathsWithObstacles(vector<vector<int>>& o) {
int m = o.size(), n = o[0].size();
vector<int> dp(n,0); dp[0] = 1-o[0][0];
for(int i = 0; i < m; i++){
for(int j = 0; j < n; j++){
if(o[i][j] == 1) { dp[j] = 0; continue;}
dp[j] = dp[j] + dp[j-1];
}
}
return dp[n-1];
}
};
```