Two Pointers

27. Remove Element

27. Remove Element 要從兩個方向看 1. 如果現在最右邊的指針,當下的值和 val 相同,想辦法往左邊移,

159. Longest Substring with At Most Two Distinct Characters

159. Longest Substring with At Most Two Distinct Characters class

567. Permutation in String

567. Permutation in String 1. 我們需要想的是窗口增大的時候,需要更新哪些資訊? 2. 如果 char

1234. Replace the Substring for Balanced String

1234. Replace the Substring for Balanced String

1358. Number of Substrings Containing All Three Characters

1358. Number of Substrings Containing All Three Characters

977. Squares of a Sorted Array

997. Squares of a Sorted Array 這一個題目的問題是給定一個排序好的陣列,計算出所有數字的次方後,再依序由小排到大。 給定的排序好的陣列看似很貼心,