Two Pointers
就像在閱讀時用手指頭一樣,在數組中也使用兩個”指針”。這兩個指針會在數組中移動來找到我們需要的答案。有時,這兩個指針會一起移動;有時,一個會比另一個移動得快;有時,它們甚至會從數組的兩個方向向中間移動。通常用它來處理找range的sum。
Sliding Window
Sliding Window是Two Pointer的一種,通常用它來處理連續數字的問題。可以想象在數組上設置了一個”窗口”,這個窗口可以變大也可以變小,就像房間裡的窗戶一樣。這個窗口會在數組中滑動,並且通常會對這個窗口內的數字進行某種計算(比如求和或者找最大值等)。
3. Longest Substring Without Repeating Characters

1151. Minimum Swaps to Group All 1’s Together

219. Contains Duplicate II

1876. Substrings of Size Three with Distinct Characters

1176. Diet Plan Performance

340. Longest Substring with At Most K Distinct Characters
