Skip to content

63. Unique Paths II#31

Open
hiro111208 wants to merge 2 commits into
mainfrom
63-unique-paths-ii
Open

63. Unique Paths II#31
hiro111208 wants to merge 2 commits into
mainfrom
63-unique-paths-ii

Conversation

@hiro111208
Copy link
Copy Markdown
Owner

This problem: 63. Unique Paths II

Next problem: 139. Word Break

```python
class Solution:
def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:
number_of_rows = len(obstacleGrid)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちらのコメントをご参照ください。
h-masder/Arai60#18 (comment)

break

for r in range(1, number_of_rows):
row[0] = row[0] if obstacleGrid[r][0] == 0 else 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if obstacleGrid[r][0] == 1:
    row[0] = 0

のほうがシンプルだと思いました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants