Skip to content

6. Zigzag Conversion#36

Open
n6o wants to merge 1 commit into
mainfrom
zigzag-conversion
Open

6. Zigzag Conversion#36
n6o wants to merge 1 commit into
mainfrom
zigzag-conversion

Conversation

@n6o
Copy link
Copy Markdown
Owner

@n6o n6o commented May 16, 2026

今回の問題

Zigzag Conversion - LeetCode

使用言語

Python

direction = -1
index += direction

return "".join("".join(row) for row in rows)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

"".join(c for row in rows for c in row)とも書けます

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.

ありがとうございます。
いろいろな書き方があるのですね。勉強になります。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

個人的には、内包表記のネストは読みづらく感じるため、原則避けるようにしています。

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.

ありがとうございます。
読みやすい/理解しやすい記載にすることを心がけます。

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.

3 participants