字符串
peace in mind
这个作者很懒,什么都没留下…
展开
-
[Leetcode] Isomorphic Strings
题目链接在此Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced原创 2015-07-30 15:29:34 · 298 阅读 · 0 评论 -
[leetcode] Palindrome Linked List
题目链接在此Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?要求用O(N)的时间和O(1)的空间,判断单链表是否为回文串。可以用一快一慢两个链表,溜一遍,寻找到链表的中原创 2015-08-12 10:47:55 · 368 阅读 · 0 评论 -
[leetcode] Implement strStr()
题目链接在此Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.模式匹配。KMP咯。说起KMP的话,自从大一上学C语言开始就有所了解,但是只知道它的用途和大概原理,从没下过功夫落实转载 2015-08-13 11:22:20 · 422 阅读 · 0 评论 -
[leetcode] Summary Ranges
题目链接在此Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].题目意思就是把连续的递增1的子序列义字符串的形式表示出来。并不是很难,原创 2015-08-05 15:49:47 · 305 阅读 · 0 评论 -
[Leetcode] Add Digits
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has on原创 2015-10-07 19:11:59 · 382 阅读 · 0 评论 -
Sicily. 全排序输出
输入一个数字n,输出从1~n组成的数字的全排列,每个排列占一行,输出按照数值升序排列比如输入3,则输出是:123132213231312321递归算法。转自这位大神#include#includeusing namespace std;void permutation(string pre, string rem转载 2015-10-10 15:27:50 · 595 阅读 · 0 评论 -
[Leetcode] Wildcard Matching
题目链接在此。Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matchi原创 2017-03-13 16:02:30 · 456 阅读 · 0 评论