# 假设数据[1,2,3,4,2,3] 读到[1,2,3,4],此时新的数据应该为[3,4,2]---
# @return int整型
#
class Solution:
def maxLength(self , arr ):
tmp,l=[],0
for i in arr:
if i not in tmp:
tmp.append(i)
l=max(len(tmp),l) #需要与之前的作比较
else:
tmp=tmp[tmp.index(i)+1:]+[i]
l=max(len(tmp),l)
return l
# write code here 
京公网安备 11010502036488号