Skip to content

Add 387. First Unique Character in a String.md#15

Open
t0hsumi wants to merge 3 commits intomainfrom
387
Open

Add 387. First Unique Character in a String.md#15
t0hsumi wants to merge 3 commits intomainfrom
387

Conversation

@t0hsumi
Copy link
Copy Markdown
Owner

@t0hsumi t0hsumi commented Jan 27, 2025

class Solution:
def firstUniqChar(self, s: str) -> int:
for index, character in enumerate(s):
if s.find(character) == s.rfind(character):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

計算量的には2乗になっていますが、find rfind がネイティブコードなので結構速そうですね。

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.



LRUcacheを使った解法
```pythonclass ListNode:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

本質ではないですが、ここでマークダウンが壊れていそうです

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