Skip to content

Spiral Matrix - #103

Open
Yuto729 wants to merge 1 commit into
mainfrom
spiral-matrix
Open

Spiral Matrix#103
Yuto729 wants to merge 1 commit into
mainfrom
spiral-matrix

Conversation

@Yuto729

@Yuto729 Yuto729 commented Aug 9, 2026

Copy link
Copy Markdown
Owner

解く問題

Spiral Matrix

次に解く問題

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

お疲れ様です。

Spiral Matrixに取り組みました。
お手隙の際にレビューをお願いいたします。

問題: https://leetcode.com/problems/spiral-matrix/
PR: #103
言語: Python3

Comment thread spiral-matrix/main.md
def spiralOrder(self, matrix: List[List[int]]) -> List[int]:
visited = set()
m, n = len(matrix), len(matrix[0])
stack = [(0, 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.

こちらのコメントをご参照ください。
rimokem/arai60#25 (comment)

今回の場合ですと、自分なら cells_to_ visit と名付けると思います。

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

cells_to_visit良いですね
ありがとうございます

Comment thread spiral-matrix/main.md
DIRECTIONS = [(0, 1), (1, 0), (0, -1), (-1, 0)] # 右, 下, 左, 上

visited = [[False] * cols for _ in range(rows)]
row = col = direction_index = 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.

複数の変数を 1 行で定義しても、読み手にとってあまり読みやすくはならないと思います。 1 変数 1 行で定義したほうが良いと思います。

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