text: class Solution(object):
      def uniquePathsWithObstacles(self, obstacleGrid):
          """
          :type obstacleGrid: List[List[int]]
          :rtype: int
          """
          if len(obstacleGrid) == 0:
              return 0
  
          rcnt = len(obstacleGrid)
          ccnt = len(obstacleGrid[0])
  
          obstacleGrid[0][0] ^= 1
  
          for i in range(1, rcnt):
              if obstacleGrid[i][0] == 1:
                  obstacleGrid[i][0] = 0
              else:
                  obstacleGrid[i][0] = obstacleGrid[i-1][0]
  
          for j in range(1, ccnt):
              if obstacleGrid[0][j] == 1:
                  obstacleGrid[0][j] = 0
              else:
                  obstacleGrid[0][j] = obstacleGrid[0][j-1]
  
          for i in range(1, rcnt):
              for j in range(1, ccnt):
                  if obstacleGrid[i][j] == 1:
                      obstacleGrid[i][j] = 0
                  else:
                      obstacleGrid[i][j] = obstacleGrid[i-1][j] + obstacleGrid[i][j-1]
  
          return obstacleGrid[rcnt-1][ccnt-1]
  