Skip to content

387 first unique character in a string#15

Open
kitano-kazuki wants to merge 2 commits intomainfrom
387-first-unique-character-in-a-string
Open

387 first unique character in a string#15
kitano-kazuki wants to merge 2 commits intomainfrom
387-first-unique-character-in-a-string

Conversation

@kitano-kazuki
Copy link
Copy Markdown
Owner

Copy link
Copy Markdown

@n6o n6o left a comment

Choose a reason for hiding this comment

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

勉強になりました!

Comment on lines +8 to +10
for i in range(len(s)):
if char_to_count[s[i]] == 1:
return i
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

文字列のインデックスと文字を使う実装も自然かなと思ったので、コメントします。

for i, c in enumerate(s):
    if char_to_count[c] == 1:
        return i

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