The following code passed with local test,but failed here:

with input [[1,0]], it outputs 0 but OJ says it outputs 1.

```
class Solution:
numPaths = [[-1]*100 for i in range(100)]
def uniquePathsWithObstacles(self, obstacleGrid):
m = len(obstacleGrid)
n = len(obstacleGrid[0])
if obstacleGrid[0][0] == 1:
self.numPaths[0][0] = 0
else:
self.numPaths[0][0] = 1
return self.d(m-1, n-1, obstacleGrid)
def d(self, i, j, obstacleGrid):
if obstacleGrid[i][j]:
return 0
if self.numPaths[i][j] >= 0:
return self.numPaths[i][j]
self.numPaths[i][j] = 0
canFromTop = (i > 0) and (obstacleGrid[i-1][j] != 1)
canFromLeft = (j > 0) and (obstacleGrid[i][j-1] != 1)
if canFromTop and canFromLeft:
self.numPaths[i][j] = self.d(i-1, j, obstacleGrid) + self.d(i, j - 1, obstacleGrid)
elif canFromLeft:
self.numPaths[i][j] = self.d(i, j - 1, obstacleGrid)
elif canFromTop:
self.numPaths[i][j] = self.d(i-1, j, obstacleGrid)
return self.numPaths[i][j]
```