Skip to content

Conversation

@Satorien
Copy link
Owner

@Satorien Satorien commented Dec 7, 2025

previous_row_length = 2 ** (n-2)
if k <= previous_row_length:
return self.kthGrammar(n-1, k)
return self.kthGrammar(n-1, k - previous_row_length) ^ 1

Choose a reason for hiding this comment

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

previous_row_length の方が step2 で書かれていた previous_end よりわかりやすくなっていると思いました。
引数の演算子の前後にスペースを入れるかどうかは統一した方が良いと思います。

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