Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Bruteforced combinations(2) solution in Clear category for Longest Substring of Unique Characters by Phil15
import itertools as it
def longest_substr(s: str) -> int:
return max((
end - start
for start, end in it.combinations(range(len(s) + 1), 2)
if len(set(s[start:end])) == end - start
), default=0)
Oct. 7, 2023