1047. Remove All Adjacent Duplicates In String,最直觀的還是 stack 方式解答。


1047. Remove All Adjacent Duplicates In String,最直觀的還是 stack 方式解答。


是 Two Sum 的一種另類進階,要從 nums 中找出和為
0的三個 element ,由於答案可能有多種,故答案會是個 List of list 。特別注意,題目中有提到不能有兩個內容一樣的 list,故要做去重處理。 也因為題目解答並沒有對 nums 的 index 有任何要求,故可以把 nums 排序,為解題拓開另一種思路。

第 16 題跟 15 題相似,又增加了些許難度。題目敘述一樣也很簡單 : 求 nums 內最接近 target 值的三數和。因為是求最接近 target 值的三數和,而解答也沒有要關注其 index,故還是可以考慮將 nums 排序,這樣就可以確定指針滑動方向。

80. Remove Duplicates from Sorted Array II是 26. Remove Duplicates from Sorted Array的進階,比較重要的也是要求 in-place 操作。

283. Move Zeroes,要求 in-place 操作,使用快慢指針來解題。

