package main
/**
*
* @param arr int整型一维数组 the array
* @return int整型
*/
func maxLength( arr []int ) int {
// write code here
left ,right := 0,0
windows := make(map[int]int)
max := 0
for right < len(arr) {
if _,ok := windows[arr[right]];ok{
for {
if arr[left] == arr[right] {
delete(windows,arr[left])
left++
break
}else{
delete(windows,arr[left])
left++
}
}
}
windows[arr[right]]++
right++
length := right - left
if length > max {
max = length
}
}
return max
}