
leetcode字符串
葱shen
爱技术,爱学习,爱游戏~
展开
-
[leetcoide] 【字符串】125. Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a原创 2016-06-11 17:23:31 · 215 阅读 · 0 评论 -
[leetcode] 【字符串】71. Simplify Path
Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"Corner Cases:Did you consider the case where p原创 2016-06-15 16:50:47 · 227 阅读 · 0 评论 -
[leetcode] 【字符串】 49. Group Anagrams
Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]Note: Al原创 2016-06-15 16:47:55 · 323 阅读 · 0 评论 -
[leetcode] 【字符串】 38. 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 "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as原创 2016-06-15 15:53:46 · 266 阅读 · 0 评论 -
[leetcode] 【字符串】13. Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.题意把罗马数字转变为int型数据题解转变的规则 ://Ⅰ(1)Ⅴ(5)Ⅹ(10)L(50)C(100)D(500)M(1000)原创 2016-06-15 15:38:46 · 226 阅读 · 0 评论 -
[leetcode] 【字符串】 12. Integer to Roman
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.题意把int型数据转换为罗马数字。题解根据罗马的转换制度由高到低转换即可 const int radix[] =原创 2016-06-15 15:08:35 · 248 阅读 · 0 评论 -
[leetcode] 【字符串】 65. Valid Number
Validate 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 problem statement to be ambiguo原创 2016-06-15 11:35:40 · 278 阅读 · 0 评论 -
[leetcode] 【字符串】 14. Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.题意找字符串数组里的最长公共前缀。题解解法很多,第一个是横向匹配,第一组与每一组对比,每比一次取最小公共前缀。匹配完则得到所有公共前缀。能通过,但是比较慢class Solution {public:原创 2016-06-15 11:10:32 · 223 阅读 · 0 评论 -
[leetcode[ 【字符串】 44. Wildcard Matching
Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matching should cover t原创 2016-06-14 23:59:19 · 240 阅读 · 0 评论 -
[leetcode] 【字符串】 10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire input st原创 2016-06-14 22:30:14 · 181 阅读 · 0 评论 -
[leetcode] 【字符串】 5. 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 unique longest palindromic substring.题意找S中的最长回文子串,回原创 2016-06-13 11:27:01 · 193 阅读 · 0 评论 -
[leetcode] 【字符串】 67. Add Binary
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".题意两个字符串表示两个二进制数,返回二进制的字符串表示他们的和。题解我是先翻转再操作,这样可以从下标0开始操作。注意长度,以及最后进位。原创 2016-06-13 11:00:30 · 239 阅读 · 0 评论 -
[leetcoide] 【字符串】8. String to Integer (atoi)
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca原创 2016-06-13 10:43:51 · 196 阅读 · 0 评论 -
[leetcoide] 【字符串】28. Implement strStr()
Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.题意两个字符串haystack和needle ,如果needle是haystack的子串,返回needle在haystack原创 2016-06-12 10:25:41 · 229 阅读 · 0 评论 -
[leetcode] 【字符串】58. Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is原创 2016-06-15 22:07:57 · 238 阅读 · 0 评论