Skip to content

49. Group Anagrams#4

Open
tshimosake wants to merge 3 commits intomasterfrom
tshimosake-patch-3
Open

49. Group Anagrams#4
tshimosake wants to merge 3 commits intomasterfrom
tshimosake-patch-3

Conversation

@tshimosake
Copy link
Owner

@@ -0,0 +1,27 @@
1回目。
Copy link

Choose a reason for hiding this comment

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

シンタックスハイライトが有効になっておらず、見づらいです。ファイル名に .py をつけ、かつソースコード部分が文字列として認識されないようにしていただきたいです。

レビューを依頼する際は、レビューする側のコストができる限り少なくなるように配慮をお願いいたします。

Copy link
Owner Author

Choose a reason for hiding this comment

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

すみません、またファイルに拡張子をつけ忘れました。

sorted_word_to_words = {}
for word in strs:
sorted_word = ''.join(sorted(word))
if sorted_word not in sorted_word_to_words:
Copy link

Choose a reason for hiding this comment

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

defaultdict を使ったほうがシンプルに書けると思います。

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