![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字符串
文章平均质量分 67
明明77
这个作者很懒,什么都没留下…
展开
-
数据结构--字符串
字符串与子串、子序列C/C++标准库提供的字符串处理函数 strlen() 返回s的长度,不包括字符串结束符null strcmp(s1,s2) 比较两个字符串s1和s2是否相同。若s1与s2星等,返回1,若s1大于s2,返回整数,若s1小于s2,则返回负数 strcat(s1,s2) 将字符串s2连接到s1后,并返回s1 strcpy(s1,s2) 将s2复制给s1,转载 2017-12-15 00:00:06 · 295 阅读 · 0 评论 -
[leetcode] 3. Longest Substring Without Repeating Characters
题目链接:https://leetcode.com/problems/longest-substring-without-repeating-characters/Given a string, find the length of the longest substring without repeating characters. For example, the longest substri转载 2017-12-15 08:36:19 · 128 阅读 · 0 评论 -
[leetcode] 5. Longest Palindromic Substring
题目链接:https://leetcode.com/problems/longest-palindromic-substring/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转载 2017-12-15 10:29:21 · 141 阅读 · 0 评论 -
KMP算法
解决问题类型字符串匹配算法说明一般匹配字符串时,我们从目标字符串str(假设长度为n)的第一个下标选取和ptr长度(长度为m)一样的子字符串进行比较,如果一样,就返回开始处的下标值,不一样,选取str下一个下标,同样选取长度为n的字符串进行比较,直到str的末尾(实际比较时,下标移动到n-m)。这样的时间复杂度是O(n*m)。KMP算法:可以实现复杂度为O(m+n)为何简化了时间复杂度: 充分利用转载 2017-12-15 00:09:51 · 517 阅读 · 0 评论 -
[Leetcode]38--Count and Say
[leetcode] 38. Count and Say题目链接:https://leetcode.com/problems/count-and-say/The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, …1 is read off as “on转载 2017-12-25 18:34:12 · 146 阅读 · 0 评论 -
[Leetcode] 53--Maximum Subarray
[leetcode] 53. Maximum Subarray题目链接:https://leetcode.com/problems/maximum-subarray/Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, g转载 2017-12-25 18:36:39 · 151 阅读 · 0 评论 -
[leetcode]58 Length of Last Word
[leetcode] 58. Length of Last Word题目连接:https://leetcode.com/problems/length-of-last-word/Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of las转载 2017-12-25 18:38:33 · 144 阅读 · 0 评论 -
[Leetcode]67.Add Binary
[leetcode] 67. Add Binary题目链接:https://leetcode.com/problems/add-binary/Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”.字符串相加class Solutio转载 2017-12-25 18:42:22 · 140 阅读 · 0 评论 -
[leetcode] 6. ZigZag Conversion
题目链接:https://leetcode.com/problems/zigzag-conversion/The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed fon转载 2017-12-17 10:07:14 · 114 阅读 · 0 评论