随笔分类 - string算法
摘要:1.题目描述 Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). ...
阅读全文
摘要:1.题目描述 Implement strStr(). Returns a pointer to the first occurrence of needle in haystack, or null if needle is ...
阅读全文
摘要:1.问题描述 Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. ...
阅读全文
摘要:1.题目描述Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.2.解法分析拿到题目的一瞬间,我就想到了两个办法,但都看起来不是那么好的方法,方法一是求出输入串和输入串逆置串(就是将输入串逆序)的最长公共字串,这个算法很容易实现,但是时间复杂度过高,还有一种就是后缀数组的方法,求出最长后缀即可,但是这种
阅读全文
摘要:1.题目描述 Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repe...
阅读全文
摘要:1.题目描述 Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Gi...
阅读全文
摘要:1.题目描述Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie, &
阅读全文