![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
lintcode
pengyou41
For Crystal.
展开
-
Lintcode(2)-比较字符串
Lintcode-比较字符串原创 2015-06-16 14:53:10 · 494 阅读 · 0 评论 -
Lintcode(3)-字符串查找
Q: 字符串查找(又称查找子字符串),是字符串操作中一个很有用的函数。你的任务是实现这个函数。 对于一个给定的 source 字符串和一个 target 字符串,你应该在 source 字符串中找出 target 字符串出现的第一个位置(从0开始)。 如果不存在,则返回 -1。 如果 source = “source” 和 target = “target”,返回 -1。如果 source原创 2015-06-17 10:43:13 · 1731 阅读 · 0 评论 -
Lintcode(1)-两个字符串是变位词
两个字符串是变位词原创 2015-06-16 14:15:31 · 1163 阅读 · 1 评论 -
Lintcode(4)-乱序字符串
乱序字符串原创 2015-06-17 19:20:08 · 893 阅读 · 0 评论 -
Lintcode(6)-最长公共前缀
Q: 给k个字符串,求出他们的最长公共前缀(LCP) 在 “ABCD” “ABEF” 和 “ACEF” 中, LCP 为 “A” 在 “ABCDEFG”, “ABCEFG”, “ABCEFA” 中, LCP 为 “ABC” A: 稍微利用一下string.at抛异常。- -!class Solution {public: /** * @param strs: A li原创 2015-06-26 11:14:30 · 462 阅读 · 0 评论 -
Lintcode(5)-最长公共子串
Q: 给出两个字符串,找到最长公共子串,并返回其长度。 给出A=“ABCD”,B=“CBCE”,返回 2 子串的字符应该连续的出现在原字符串中,这与子序列有所不同。 A: 可以使用动态规划让时间复杂度降至O(n²) 关于动态规划这篇文章写得很好很强大! 这里使用最原始的办法,时间复杂度O(n³)class Solution {public: /** * @param原创 2015-06-26 10:45:27 · 392 阅读 · 0 评论 -
Lintcode(7)-删除元素
Q: Remove Element. Given an array and a value, remove all occurrences of that value in place and return the new length. The order of elements can be changed, and the elements after the new length do原创 2015-06-29 10:38:32 · 467 阅读 · 0 评论