#
# 
# @param arr int整型一维数组 the array
# @return int整型
#
class Solution:
    def maxLength(self , arr ):
        # write code here
        right = 0
        left = 0
        maxLen = -1
        dic = {}
        a = len(arr)
        while right < a:
            if arr[right] not in dic:
                dic[arr[right]] = right
                maxLen = max(maxLen, right - left +1)
                right += 1
            else:
                dic.pop(arr[left])
                left += 1
        return maxLen