public int uniquePathsWithObstacles(int[][] obstacleGrid) {
    	int m = obstacleGrid.length, n=obstacleGrid[0].length;
    	int[][] steps = new int[m][n];
    	steps[0][0] = (obstacleGrid[0][0]==0?1:0); 

    	for(int i =1; i<m; i++) 
    		steps[i][0] =(obstacleGrid[i][0]==1? 0:steps[i-1][0]);

    	
    	for(int i =1; i<n; i++) 
    		steps[0][i] =(obstacleGrid[0][i]==1? 0:steps[0][i-1]);

    	
    	for(int i=1; i<m; i++)
    	{
    		for(int j=1; j<n; j++)
    		{
    			if(obstacleGrid[i][j]==1) 
    				steps[i][j] = 0;
    			else
   					steps[i][j] = steps[i-1][j] + steps[i][j-1];
    		}
    	}
    	return steps[m-1][n-1];
    	
    }