python – Length of the longest non-repeated substring challenge using a sliding window

I'm working on Leetcode challenge # 3 (

Here is my solution using the sliding window and a dictionary. I have specifically added beginning = seen[s[i]]+1 jump forward. I am still told that I am much slower than most people (for example, given abcdefgdabc, I jump ABC when I see the second re. I thought it would save a lot of time, but apparently, this algorithm has a poor run time.

    Class Solution (object):
def lengthOfLongestSubstring (ie, s):
"" "
: type s: str
: rtype: int
"" "
vu = {}
start = 0
max_size = 0

# check if the left pointer has arrived at the end
starting with <len (s):
size = 0
for i in the beach (start, len (s)):
if s[i] seen in:
beginning = seen[s[i]]+1
vu = {}
seen[s[i]]= i
size + = 1
max_size = size (size, max_size)
returns max_size