Python sliding window (simple syntax)
Python sliding window. \n\n\nclass Solution(object):\n    def lengthOfLongestSubstring(self, s):\n        # create a window with left and right\n        # keep 
Python sliding window. \n\n```\nclass Solution(object):\n    def lengthOfLongestSubstring(self, s):\n        # create a window with left and right\n        # keep a hash of elements already added\n        left = 0\n        right = 0\n        seen = {} # keeps track of seen elements\n\n        max_count = 0\n\n        for i, character in enumerate(s):\n            if character not in seen or seen[character] < left: # notice this logic\n                seen[character] = i\n                right = i\n                if (right - left + 1) > max_count: # update the largest count\n                    max_count = (right - left + 1)\n            else:\n                # we move start to one element after we found the character\n                left = seen[character] + 1\n                seen[character] = i # update index of last time we saw the character\n\n        return max_count\n```
['Sliding Window', 'Python']