3-Longest-Substring-Without-Repeating-Characters
Sat 17 May 2025
https://leetcode.com/problems/longest-substring-without-repeating-characters
import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
ans = 0
count = Counter()
l = 0
for r, c in enumerate(s):
count[c] += 1
while count[c] > 1:
count[s[l]] -= 1 …Category: leetcode
Read More