Conversation
| ```py | ||
| class Solution: | ||
| def uniquePaths(self, m: int, n: int) -> int: | ||
| kaijou = [1] * (m + n) |
There was a problem hiding this comment.
日本語を変数名に付けた場合、英語話者にとって読みにくくなると思います。 factorial はいかがでしょうか?
| if i == 0: | ||
| kaijou[0] = 1 | ||
| continue | ||
| kaijou[i] = kaijou[i-1] * i |
There was a problem hiding this comment.
二項演算子の両側のスペースが、コード内で統一されていないのが気になりました。空けるほうに統一することをお勧めいたします。
参考までにスタイルガイドへのリンクを貼ります。
https://peps.python.org/pep-0008/#other-recommendations
Always surround these binary operators with a single space on either side: assignment (=), augmented assignment (+=, -= etc.), comparisons (==, <, >, !=, <=, >=, in, not in, is, is not), Booleans (and, or, not).
https://google.github.io/styleguide/pyguide.html#36-whitespace
Surround binary operators with a single space on either side for assignment (=), comparisons (==, <, >, !=, <>, <=, >=, in, not in, is, is not), and Booleans (and, or, not). Use your better judgment for the insertion of spaces around arithmetic operators (+, -, *, /, //, %, **, @).
上記のスタイルガイドは唯一絶対のルールではなく、複数あるスタイルガイドの一つに過ぎないということを念頭に置くことをお勧めします。また、所属するチームにより何が良いとされているかは変わります。自分の中で良い書き方の基準を持ちつつ、チームの平均的な書き方で書くことをお勧めいたします。
https://leetcode.com/problems/unique-paths/description