count.remove(tree[l++], 0); // remove(Object key, Object value) - Removes the entry for the specified key only if it is currently mapped to the specified value.
}
r++;
max = Math.max(max,r-l);
}
returnmax;
}
}
//Alternatively we dont need a left pointer to traverse till all tree[l] are removed