An Efficient Solution is to use the count of previous window, while sliding the window. The idea is to create a hash map that stores elements.
sliding window algorithm
1 Article
1
An Efficient Solution is to use the count of previous window, while sliding the window. The idea is to create a hash map that stores elements.