2020-05-24 Leetcode两日打卡 - 数组

【刷题汇报】5.23 - 2题

#3 Sliding window,Hashmap. Can be optimized to at most n steps.

#75 Three pointers. The first tracks the rightmost index of the 0 zones, the second is the current index being considered, and the third tracks the leftmost index of the 2 zones. The second pointer do not need to go through the whole list - the loop ends if the second pointer encounters the third pointer or the first pointer encounters the third pointer

【刷题汇报】5.24 - 3题

#88 Two pointers both starting from the end of the array. The reason to start from the end is to avoid replacing the original numbers on num1 (num1 are filled with unimportant numbers in the end). Space Complexity: O(1). Time Complexity: O(m+n)

#125 Two pointers. One starts from the beginning of the array, the other starts from the end of the array. Whenever the lower case of the letters these pointers point to are not the same, the program returns false.

#76 Sliding window. Use two hash maps. the first hash map is to store the required characters and the corresponding number of occurrences. The second one is to track the required characters and the number of occurrences during the traversal of s.

你可能感兴趣的:(2020-05-24 Leetcode两日打卡 - 数组)