Two Pointers

83. Remove Duplicates from Sorted List

83. Remove Duplicates from Sorted List # Definition for singly-linked list.

1248. Count Number of Nice Subarrays

1248. Count Number of Nice Subarrays

3. Longest Substring Without Repeating Characters

3. Longest Substring Without Repeating Characters 這一題其實是可以透過暴力解法想辦法算出來的,那就是窮舉出所有的子字串,並且檢查每一個子字串有沒有重複的字元。時間複雜度約為

438. Find All Anagrams in a String

483. Find All Anagrams in a String 1. 我們需要想的是窗口增大的時候,需要更新哪些資訊?

992. Subarrays with K Different Integers

992. Subarrays with K Different Integers 先見算出「最多」 k 個不同的數字的組合,

26. Remove Duplicates from Sorted Array

26. Remove Duplicates from Sorted Array 雙指針問題 class Solution: def

11. Container With Most Water

11. Container With Most Water 解題的核心想法是有一句俗諺:水桶的最大容量決定於最矮的一邊。 題目給出的正是水桶高度,只是俗諺中的水桶,底部的面積都一樣,

142. Linked List Cycle II

142. Linked List Cycle II 承上題,這個題目除了要確定題目中的 Linked List 有沒有環,

424. Longest Repeating Character Replacement

424. Longest Repeating Character Replacement class Solution: def characterReplacement(self,

76. Minimum Window Substring

76. Minimum Window Substring 滑動窗口的經典題目,題目要求要找到最短的子字串,裡面包含了 t 字串有的字元。 1.