Skip to content

Find All Anagrams In A String#98

Open
tom4649 wants to merge 2 commits into
mainfrom
438.Find-All-Anagrams-in-a-String
Open

Find All Anagrams In A String#98
tom4649 wants to merge 2 commits into
mainfrom
438.Find-All-Anagrams-in-a-String

Conversation

@tom4649
Copy link
Copy Markdown
Owner

@tom4649 tom4649 commented May 17, 2026

return []

count_p = collections.Counter(p)
window = collections.Counter(s[:len_p])
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

window は文字列であれば部分文字列のことを指すと思いますので、 Counter の変数名としては違和感を感じました。

if len_p > len_s:
return []

count_p = collections.Counter(p)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

動詞の原形または命令形が変数名の先頭にあると、メソッド名のように感じます。 char_frequencies_in_p や char_histogram_in_p あたりはいかがでしょうか?

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.

長すぎるのを避けるため、histogram_in_pとしました。sの方もそのようにします。

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