随笔分类 -  string

1 2 下一页

[leecode]Implement strStr()
摘要:Implement strStr()Implement strStr().Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack.实现String... 阅读全文

posted @ 2014-09-14 23:13 喵星人与汪星人 阅读(189) 评论(0) 推荐(0) 编辑

KMP算法小结
摘要:今天又把KMP算法看了一遍,特此小结。扯淡的话:KMP算法主要用来模式匹配。正如Implement strStr()中形容的一样,“大海捞针”,当时看到题中变量如此命名,真的感觉实在是再贴切不过了。在介绍KMP算法之前,先介绍一下BF算法,叫的这么暧昧(who is GF?),其实就是最low的暴力... 阅读全文

posted @ 2014-09-14 22:45 喵星人与汪星人 阅读(1021) 评论(0) 推荐(0) 编辑

[leecode]Scramble String
摘要:Scramble StringGiven a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible... 阅读全文

posted @ 2014-09-01 23:38 喵星人与汪星人 阅读(146) 评论(0) 推荐(0) 编辑

[leecode]Word Break II
摘要:Word Break IIGiven a stringsand a dictionary of wordsdict, add spaces insto construct a sentence where each word is a valid dictionary word.Return all... 阅读全文

posted @ 2014-08-24 22:49 喵星人与汪星人 阅读(283) 评论(0) 推荐(0) 编辑

[leetcode]Valid Number
摘要:Valid NumberValidate if a given string is numeric.Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>trueNote:It is intended for the ... 阅读全文

posted @ 2014-08-16 00:02 喵星人与汪星人 阅读(765) 评论(0) 推荐(0) 编辑

[leetcode]Interleaving String
摘要:Interleaving StringGivens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", r... 阅读全文

posted @ 2014-08-15 21:25 喵星人与汪星人 阅读(393) 评论(0) 推荐(0) 编辑

[leetcode]Minimum Window Substring
摘要:Minimum Window SubstringGiven 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).Fo... 阅读全文

posted @ 2014-08-15 17:04 喵星人与汪星人 阅读(316) 评论(0) 推荐(0) 编辑

[leetcode]String to Integer (atoi)
摘要:String to Integer (atoi)Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, plea... 阅读全文

posted @ 2014-08-14 00:23 喵星人与汪星人 阅读(230) 评论(0) 推荐(0) 编辑

[leetcode]Regular Expression Matching
摘要:Regular Expression MatchingImplement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more o... 阅读全文

posted @ 2014-08-08 16:37 喵星人与汪星人 阅读(368) 评论(0) 推荐(0) 编辑

[leetcode]Palindrome Partitioning II
摘要:Palindrome Partitioning IIGiven a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a p... 阅读全文

posted @ 2014-08-07 19:39 喵星人与汪星人 阅读(244) 评论(0) 推荐(0) 编辑

[leetcode]Word Break
摘要:Word BreakGiven a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.... 阅读全文

posted @ 2014-08-05 01:06 喵星人与汪星人 阅读(630) 评论(0) 推荐(0) 编辑

[leetcode]Decode Ways
摘要:Decode WaysA message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded me... 阅读全文

posted @ 2014-08-03 14:55 喵星人与汪星人 阅读(283) 评论(0) 推荐(0) 编辑

[leetcode]Distinct Subsequences
摘要:Distinct SubsequencesGiven a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is... 阅读全文

posted @ 2014-08-02 02:46 喵星人与汪星人 阅读(338) 评论(0) 推荐(0) 编辑

[leetcode]Longest Valid Parentheses
摘要:Longest Valid ParenthesesGiven a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substr... 阅读全文

posted @ 2014-08-02 02:01 喵星人与汪星人 阅读(1514) 评论(2) 推荐(0) 编辑

[leetcode]Edit distance
摘要:Edit DistanceGiven two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You... 阅读全文

posted @ 2014-08-01 22:36 喵星人与汪星人 阅读(387) 评论(0) 推荐(0) 编辑

[leetcode]Anagrams
摘要:AnagramsGiven an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.编程珠玑中的一道题,书中的解法很巧妙,我就直接搬来用了,时... 阅读全文

posted @ 2014-08-01 19:56 喵星人与汪星人 阅读(359) 评论(0) 推荐(0) 编辑

[leetcode]Text Justification
摘要:Text JustificationGiven an array of words and a lengthL, format the text such that each line has exactlyLcharacters and is fully (left and right) just... 阅读全文

posted @ 2014-08-01 19:21 喵星人与汪星人 阅读(996) 评论(0) 推荐(0) 编辑

[leetcode]Longest Palindromic Substring
摘要:Longest Palindromic SubstringGiven a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there... 阅读全文

posted @ 2014-08-01 00:32 喵星人与汪星人 阅读(288) 评论(0) 推荐(0) 编辑

[leetcode]Longest Substring Without Repeating Characters
摘要:Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example, the ... 阅读全文

posted @ 2014-07-31 22:56 喵星人与汪星人 阅读(200) 评论(0) 推荐(0) 编辑

[leetcode]Longest Common Prefix
摘要:Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.算法思路:思路:貌似木有什么捷径,逐个比较,遇到不同即断开。代码如下: 1 publi... 阅读全文

posted @ 2014-07-31 21:52 喵星人与汪星人 阅读(179) 评论(0) 推荐(0) 编辑

1 2 下一页