String
柯森锎
92年的小学生
展开
-
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.题目解析找出最大的回文子串; 开始的想法是遍原创 2016-09-22 20:30:05 · 217 阅读 · 0 评论 -
LeetCode 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 cas原创 2016-09-23 22:40:16 · 337 阅读 · 0 评论 -
LeetCode 3. Longest Substring Without Repeating Characters
题目描述Given a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb”, the answer is “abc”, which the length is 3.Given “bbbbb”, the answer is “b”, with th原创 2016-09-21 19:27:54 · 271 阅读 · 0 评论 -
LeetCode 10. Regular Expression Matching(hard)
题目描述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-09-25 21:22:28 · 353 阅读 · 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.题目解析将阿拉伯数字转换为罗马数字。 罗马数字表示方法: I-1,X-10,C-100,M-1000; V-5,L-50,D-500; 1. 相同的数字连写、所表示的数等原创 2016-10-22 23:22:41 · 297 阅读 · 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.代码class Solution {public: int romanToInt(string s) { map<char,int>dig;原创 2016-10-22 23:48:59 · 345 阅读 · 0 评论 -
LeetCode 14. Longest Common Prefix (easy)
题目描述Write a function to find the longest common prefix string amongst an array of strings.代码class Solution {public: string longestCommonPrefix(vector<string>& strs) { int n_str=strs.size()原创 2016-10-23 16:12:14 · 318 阅读 · 0 评论 -
LeetCode 32. Longest Valid Parentheses(hard)
题目描述Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.For “(()”, the longest valid parentheses substring is “()”, which原创 2016-09-29 18:59:08 · 341 阅读 · 0 评论 -
LeetCode 17. Letter Combinations of a Phone Number
题目描述Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Digit string "2原创 2016-11-17 22:58:52 · 403 阅读 · 0 评论