Skip to content

Create 3. Longest Substring Without Repeating Characters.md#21

Merged
Mike0121 merged 2 commits intomainfrom
3.-Longest-Substring-Without-Repeating-Characters
Nov 1, 2025
Merged

Create 3. Longest Substring Without Repeating Characters.md#21
Mike0121 merged 2 commits intomainfrom
3.-Longest-Substring-Without-Repeating-Characters

Conversation

@Mike0121
Copy link
Copy Markdown
Owner

@Mike0121 Mike0121 commented Jun 1, 2024

Comment on lines 40 to 44
Copy link
Copy Markdown

@thonda28 thonda28 Jun 1, 2024

Choose a reason for hiding this comment

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

dict を使うのであれば、value に index を指定してみてはどうでしょうか?今の実装だと value が 0 または 1 で実質 bool のように扱っているので、コメントにあるように dict を使う旨味がなさそうです。(また 0 または 1 しか入らないにも関わらず int 型なのも少し違和感があります。)

{s[right]: right} として value に index を持たせる実装にすると、while 文を使わずに left を更新できるので少しは旨味がありそうです。

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.

すみません、ご指摘の通り、この実装はindexを記録できていないですね。
かなり意味ないことをしておりました。書き直します。

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.

アドバイスを基に書き直しました。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

これはdict()で良さそうです。

@Mike0121 Mike0121 merged commit 8b2f06f into main Nov 1, 2025
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