49. Group Anagrams - #12
Open
kazizi55 wants to merge 1 commit into
Open
Conversation
kazizi55
marked this pull request as ready for review
July 12, 2026 14:15
chryschron
reviewed
Jul 13, 2026
| counts = [0] * 26 | ||
| for c in s: | ||
| alphabet_index = ord(c) - ord("a") | ||
| if not 0 <= alphabet_index < 26: |
There was a problem hiding this comment.
この評価ができない文字コードも一応存在します。
Owner
Author
There was a problem hiding this comment.
ありがとうございます。知らなかったので勉強になりました。
確かにa–i (0x81–0x89), j–r (0x91–0x99), s–z (0xA2–0xA9)のような感じでところどころ1飛ばしになっていますね!
https://en.wikipedia.org/wiki/EBCDIC
skypenguins
reviewed
Jul 20, 2026
| ## Step 3 | ||
|
|
||
| - Step 2の解法1で解いた。 | ||
| - 実装がシンプルで分かりやすいのと、"".join(sorted(s)) を使うよりもワンライナーで書いた時の認知負荷が若干こっちの方が低い気がしたのでこちらが好み。 |
There was a problem hiding this comment.
個人的には "".join(sorted(s)) の方が馴染みがありますが、好みの範囲かもしれません。
Owner
Author
There was a problem hiding this comment.
list を str に変える方が、色んなことに転用される可能性が多い という理由で私は tuple を使う方が好みと書いていましたが、どちらがいろんなことに転用されうるかというのは読み手の考え方次第だなと思い直したので、確かに好みの範囲かもですね。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://leetcode.com/problems/group-anagrams/description/
Next: https://leetcode.com/problems/intersection-of-two-arrays/