Python || 96.09% Faster || DP || Recursive + Memoization
Recursive Solution but it will give TLE :\n\nclass Solution:\n    def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:\n        m,n=len(obs
**Recursive Solution but it will give TLE :**\n```\nclass Solution:\n    def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:\n        m,n=len(obstacleGrid),len(obstacleGrid[0])\n        def countPath(i,j):\n            if i>=m or j>=n or obstacleGrid[i][j]==1 :\n                return 0\n            if i==m-1 and j==n-1:\n                if obstacleGrid[i][j]==1:\n                    return 0\n                return 1\n            return countPath(i+1,j) + countPath(i,j+1)\n        return countPath(0,0)\n```\n**Recursive + Memoiztion Solution (Top Down Approach) :**\n```\nclass Solution:\n    def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:\n        m,n=len(obstacleGrid),len(obstacleGrid[0])\n        def countPath(i,j):\n            if i>=m or j>=n or obstacleGrid[i][j]==1:\n                dp[i][j]=0\n            if i==m-1 and j==n-1:\n                if obstacleGrid[i][j]==1:\n                    return 0\n                dp[i][j]=1\n            if dp[i][j]!=-1:\n                return dp[i][j]\n            dp[i][j] = countPath(i+1,j) + countPath(i,j+1)\n            return dp[i][j]\n        dp=[[-1 for i in range(n+1)] for j in range(m+1)]\n        return countPath(0,0)\n```\n\n**An upvote will be encouraging**\n
['Dynamic Programming', 'Recursion', 'Memoization', 'Python', 'Python3']