Sliding window is a little different from two pointer. I personally found it hard to understand how, thus this article.
There are several possible implementations of a sliding window pattern. Which one is the best in the given situation - depends on the problem.
deque
hash
References
Expand…
Educative Grokking Interview
https://www.educative.io/courses/grokking-coding-interview-patterns-python/RMkpmAllP9L