We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dc2adcc commit e97b0e9Copy full SHA for e97b0e9
longest-substring-without-repeating-characters/printjin-gmailcom.py
@@ -0,0 +1,14 @@
1
+class Solution:
2
+ def lengthOfLongestSubstring(self, s):
3
+ char_set = set()
4
+ left = 0
5
+ max_len = 0
6
+
7
+ for right in range(len(s)):
8
+ while s[right] in char_set:
9
+ char_set.remove(s[left])
10
+ left += 1
11
+ char_set.add(s[right])
12
+ max_len = max(max_len, right - left + 1)
13
14
+ return max_len
0 commit comments