<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> class Solution : <EOL> def uniquePathsWithObstacles ( self , obstacleGrid ) : <EOL> """<STR_LIT>""" <EOL> m = len ( obstacleGrid ) <EOL> n = len ( obstacleGrid [ <NUM_LIT:0> ] ) <EOL> if obstacleGrid [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] == <NUM_LIT:1> or obstacleGrid [ m - <NUM_LIT:1> ] [ n - <NUM_LIT:1> ] == <NUM_LIT:1> : <EOL> return <NUM_LIT:0> <EOL> path = [ [ <NUM_LIT:0> for _ in range ( n ) ] for _ in range ( m ) ] <EOL> path [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] = <NUM_LIT:1> <EOL> for i in range ( m ) : <EOL> for j in range ( n ) : <EOL> if i == <NUM_LIT:0> and j == <NUM_LIT:0> : <EOL> continue <EOL> if i == <NUM_LIT:0> : <EOL> path [ i ] [ j ] = path [ i ] [ j - <NUM_LIT:1> ] if obstacleGrid [ i ] [ j - <NUM_LIT:1> ] == <NUM_LIT:0> else <NUM_LIT:0> <EOL> elif j == <NUM_LIT:0> : <EOL> path [ i ] [ j ] = path [ i - <NUM_LIT:1> ] [ j ] if obstacleGrid [ i - <NUM_LIT:1> ] [ j ] == <NUM_LIT:0> else <NUM_LIT:0> <EOL> else : <EOL> if obstacleGrid [ i ] [ j - <NUM_LIT:1> ] == <NUM_LIT:0> and obstacleGrid [ i - <NUM_LIT:1> ] [ j ] == <NUM_LIT:0> : <EOL> path [ i ] [ j ] = path [ i - <NUM_LIT:1> ] [ j ] + path [ i ] [ j - <NUM_LIT:1> ] <EOL> elif obstacleGrid [ i ] [ j - <NUM_LIT:1> ] == <NUM_LIT:0> : <EOL> path [ i ] [ j ] = path [ i ] [ j - <NUM_LIT:1> ] <EOL> elif obstacleGrid [ i - <NUM_LIT:1> ] [ j ] == <NUM_LIT:0> : <EOL> path [ i ] [ j ] = path [ i - <NUM_LIT:1> ] [ j ] <EOL> else : <EOL> path [ i ] [ j ] = <NUM_LIT:0> <EOL> return path [ m - <NUM_LIT:1> ] [ n - <NUM_LIT:1> ] <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> grid = [ [ <NUM_LIT:0> , <NUM_LIT:0> ] , [ <NUM_LIT:1> , <NUM_LIT:1> ] , [ <NUM_LIT:0> , <NUM_LIT:0> ] ] <EOL> assert Solution ( ) . uniquePathsWithObstacles ( grid ) == <NUM_LIT:0> </s>
