本篇梳理「归并多个有序列表」问题。求和问题是指一类从数组中找出 K 个数满足其和为给定整数的问题。
[LC14] Longest Common Prefix / 二分查找 / 分治
Longest Common Prefix - LeetCode
Write a function to find the longest common prefix string amongst an array of strings.
[LC11/19/27] Container With Most Water / 双指针
本篇总结了两个使用「双指针」解决问题的方法。都达到了扫描一遍计算结果的效果,区别在于,一个是「相遇问题」,一个是「追及问题」。
[LC10] Regular Expression Matching / 递归 / 动态规划
Regular Expression Matching - LeetCode
Implement regular expression matching with support for
'.'
and'*'
.
[LC5/9] Palindrome Problems / 动态规划
第5题和第9题都与「回文字符串」有关,且用到了经典的「动态规划」方法。在「最长回文串」问题中,Manacher 算法是一种技巧性极高的经典方法。
[LC3] Longest Substring Without Repeating Characters
Longest Substring Without Repeating Characters - LeetCode
Given a string, find the length of the longest substring without repeating characters.
Examples:
Given"abcabcbb"
, the answer is"abc"
, which the length is 3.
Given"bbbbb"
, the answer is"b"
, with the length of 1.
Given"pwwkew"
, the answer is"wke"
, with the length of 3. Note that the answer must be a substring,"pwke"
is a subsequence and not a substring.