class Solution: def maxLength(self , arr: List[int]) -> int: # write code here import collections queue = collections.deque() queue.append(arr[0]) length = 0 for i in range(1, len(arr)): if arr[i] in queue: length = max(length, len(queue)) while arr[i] in queue: queue.popleft() queue.append(arr[i]) return max(length, len(queue))