Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions JungHwan/Day21/NeetCode_LongestSubstringWithoutDuplicates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
l, r = 0, 0
maxl = 0
while r < len(s):
for i in range(l, r):
if s[r] == s[i]: #found duplicate
l = r = i + 1
break
#duplicate not found
maxl = max(maxl, r - l + 1)
r += 1
return maxl
Loading