Create 3. Longest Substring Without Repeating Characters.md#48
Open
Create 3. Longest Substring Without Repeating Characters.md#48
Conversation
huyfififi
approved these changes
Aug 12, 2025
| letters_in_window.remove(s[left]) | ||
| left += 1 | ||
| letters_in_window.add(s[right]) | ||
| longest_length =max(longest_length, right - left + 1) |
| longest_length = 0 | ||
|
|
||
| end_index = 0 | ||
| characters = collections.defaultdict(int) |
There was a problem hiding this comment.
step 1の解答にコメントを残すのは無粋かもしれませんが、このdefaultdictで文字とそのカウントが対応していることを読み取るのに少し時間がかかりました。既に意識されていることと思いますが、char_to_countにするか、0か1のフラグを保持していることを伝えられるといいな、と思いました。
Owner
Author
There was a problem hiding this comment.
そちらの方がわかりやすいですね。コメントありがとうございます。
Fuminiton
reviewed
Aug 14, 2025
| return longest_length | ||
| ``` | ||
|
|
||
| 2分,2分,1分で3回Accept |
ryosuketc
reviewed
Aug 14, 2025
| def lengthOfLongestSubstring(self, s: str) -> int: | ||
| longest_length = 0 | ||
| left = 0 | ||
| letters_in_window = set() |
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.
This Problem
3. Longest Substring Without Repeating Characters
Next Ploblem
209. Minimum Size Subarray Sum
言語: Python