![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
CodeReview->String
文章平均质量分 81
amberFeb
这个作者很懒,什么都没留下…
展开
-
第24题 Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".click to show clarification.Clarification:What constitutes原创 2014-10-21 21:57:58 · 497 阅读 · 0 评论 -
第44题 Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()()"原创 2015-01-20 18:28:23 · 357 阅读 · 0 评论 -
第43题 Edit Distance
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:原创 2015-01-20 17:47:29 · 285 阅读 · 0 评论 -
第27题 ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I原创 2015-01-03 17:35:59 · 304 阅读 · 0 评论 -
第28题 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原创 2015-01-04 15:36:27 · 386 阅读 · 0 评论 -
第29题 Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all vali原创 2015-01-04 17:47:38 · 382 阅读 · 0 评论 -
第30题 Add Binary
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".Hide Tags Math String原创 2015-01-06 15:50:19 · 458 阅读 · 0 评论 -
第48题 Interleaving String
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbbaccc", retur原创 2015-03-17 16:44:08 · 362 阅读 · 0 评论 -
第50题 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.Hide Tags String原创 2015-03-18 03:08:35 · 384 阅读 · 0 评论 -
第49题 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 st原创 2015-03-18 01:29:34 · 277 阅读 · 0 评论 -
第51题 Longest Valid Parentheses
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 "()", wh原创 2015-04-04 17:23:02 · 492 阅读 · 0 评论 -
第36题 Compare Version Numbers
Compare two version numbers version1 and version1.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-empty and cont原创 2015-01-13 18:19:37 · 428 阅读 · 0 评论 -
第52题 Minimum Window Substring
Given 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).For example,S = "ADOBECODEBANC"T = "ABC"Minimum window is "BANC".原创 2015-04-28 02:29:39 · 394 阅读 · 0 评论 -
第73题 Largest Number
Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The result may be very原创 2015-05-11 16:34:22 · 352 阅读 · 0 评论 -
第75题 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 with another原创 2015-05-11 17:53:45 · 304 阅读 · 0 评论 -
第41题 Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total numb原创 2015-01-17 17:26:30 · 255 阅读 · 0 评论 -
第38题 Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For原创 2015-01-17 15:15:59 · 307 阅读 · 0 评论 -
第40题 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 def原创 2015-01-17 15:28:31 · 399 阅读 · 0 评论 -
第25题 Simplify Path
Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"click to show corner cases.Corner Cases:Did原创 2014-10-28 07:51:09 · 399 阅读 · 0 评论 -
第26题 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原创 2014-10-30 04:49:49 · 344 阅读 · 0 评论 -
第33题 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 pa原创 2015-01-06 18:17:43 · 362 阅读 · 0 评论 -
第31题 Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.Hide Tags Math StringSolution in原创 2015-01-06 16:33:37 · 346 阅读 · 0 评论 -
第32题 Anagrams
Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.Hide Tags Hash Table String原创 2015-01-06 17:28:45 · 329 阅读 · 0 评论 -
第45题 Implement strStr()
Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Update (2014-11-02):The signature of the function had been updated to原创 2015-01-26 16:47:13 · 495 阅读 · 0 评论 -
第46题 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原创 2015-01-29 17:04:15 · 422 阅读 · 0 评论 -
第34题 Restore IP Addresses
Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.35"]. (Order do原创 2015-01-11 20:32:45 · 241 阅读 · 0 评论 -
第35题 Substring with Concatenation of All Words
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without原创 2015-01-13 17:44:43 · 442 阅读 · 0 评论 -
第47题 Integer to Roman
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.Hide Tags Math StringSolution in原创 2015-02-01 17:54:36 · 442 阅读 · 0 评论 -
第39题 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 "o原创 2015-01-17 15:24:21 · 271 阅读 · 0 评论 -
第37题 Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.Hide Tags StringSolution in Java:public class Solution { p转载 2015-01-17 14:59:16 · 420 阅读 · 0 评论 -
第42题 Distinct Subsequences
Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be none)原创 2015-01-19 17:27:19 · 407 阅读 · 0 评论 -
第53题 Multiply Strings
Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative.Hide Tags Math String原创 2015-04-29 00:23:12 · 332 阅读 · 0 评论