
lintcode
happhello
这个作者很懒,什么都没留下…
展开
-
两个字符串是变位词
题目链接:http://www.lintcode.com/zh-cn/problem/two-strings-are-anagrams题目描述:写出一个函数 anagram(s, t) 判断两个字符串是否可以通过改变字母的顺序变成一样的字符串。样例:给出 s = "abcd",t="dcab",返回 true.给出 s = "ab", t = "ab", 返回 true.给出 s = "ab", ...原创 2018-03-09 10:00:26 · 262 阅读 · 0 评论 -
字符串查找
题目链接:http://www.lintcode.com/zh-cn/problem/strstr/问题描述: 对于一个给定的 source 字符串和一个 target 字符串,你应该在 source 字符串中找出 target 字符串出现的第一个位置(从0开始)。如果不存在,则返回 -1。 解决思路:采用双重for循环解决,思路清晰,代码较容易写,但效率不高,另外一种方法是用KMP算法...原创 2018-03-05 17:39:54 · 192 阅读 · 0 评论