随笔分类 - leetcode
摘要:Implement regular expression matching with support for '.' and '*'. f[i][j - 2]表示前面的元素出现0次,后面表示出现次数大于等于1. aabbb aab.* 能够出现多次,说明s中减少一个(i -1)也能匹配,所以这个条件
阅读全文
摘要:139. Word Break Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a spac
阅读全文
摘要:143. Reorder List Given a singly linked list L: L0?L1?…?Ln-1?Ln,reorder it to: L0?Ln?L1?Ln-1?L2?Ln-2?… You must do this in-place without altering the
阅读全文
摘要:https://leetcode.com/problems/sort-list/description/ Sort a linked list in O(n log n) time using constant space complexity. 链表类题目找中间点使用双指针算法,要判断head -
阅读全文
摘要:86. Partition List Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You s
阅读全文
摘要:82. Remove Duplicates from Sorted List II Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from
阅读全文
摘要:83. Remove Duplicates from Sorted List Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1-
阅读全文

浙公网安备 33010602011771号