Python | Easy Solution
Intuition\nYou can solve this problem using dynamic programming.\n\n# Approach\nYou can solve this problem using dynamic programming. The idea is to create a 2D
# Intuition\nYou can solve this problem using dynamic programming.\n\n# Approach\nYou can solve this problem using dynamic programming. The idea is to create a 2D DP array where each cell `(i, j)` represents the number of unique paths to reach that cell. If the cell contains an obstacle, then the number of paths to that cell is 0. Otherwise, you can calculate the number of paths by adding the number of paths from the cell above `(i-1, j)` and the cell to the left `(i, j-1)`.\n\n\n\n# Complexity\n- Time complexity:\nO(mn)\n\n- Space complexity:\nO(mn)\n\n# Code\n```\nclass Solution(object):\n    def uniquePathsWithObstacles(self, obstacleGrid):\n        """\n        :type obstacleGrid: List[List[int]]\n        :rtype: int\n        """\n        m, n = len(obstacleGrid), len(obstacleGrid[0])\n    \n        # Create a DP array initialized with 0\n        dp = [[0] * n for _ in range(m)]\n        \n        # Initialize the starting point\n        dp[0][0] = 1 if obstacleGrid[0][0] == 0 else 0\n        \n        # Fill in the DP array\n        for i in range(m):\n            for j in range(n):\n                if obstacleGrid[i][j] == 1:\n                    dp[i][j] = 0\n                else:\n                    if i > 0:\n                        dp[i][j] += dp[i - 1][j]\n                    if j > 0:\n                        dp[i][j] += dp[i][j - 1]\n        \n        return dp[m - 1][n - 1]\n```\n# **PLEASE DO UPVOTE!!!\uD83E\uDD79**
['Dynamic Programming', 'Python']