上一页 1 ··· 4 5 6 7 8 9 10 下一页
摘要: 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 has length = 2.Another example is ")()())", where the lo 阅读全文
posted @ 2012-09-21 04:47 ETCOW 阅读(387) 评论(0) 推荐(0) 编辑
摘要: 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 "bbbbb" the longest substring is "b", with the length of 1. 阅读全文
posted @ 2012-09-21 04:09 ETCOW 阅读(399) 评论(0) 推荐(0) 编辑
摘要: 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. 1 public static string LongestPalindromicSubstring(string s) 2 { 3 if (s.Length <= 1) 4 ... 阅读全文
posted @ 2012-09-20 05:37 ETCOW 阅读(417) 评论(0) 推荐(0) 编辑
摘要: Write a function to find the longest common prefix string amongst an array of strings 1 public static string LongestCommonPrefix(List<string> strs) 2 { 3 if (strs.Count == 0) 4 return ""; 5 if (strs.Count == 1) 6 return strs[0];... 阅读全文
posted @ 2012-09-20 03:42 ETCOW 阅读(316) 评论(0) 推荐(0) 编辑
摘要: 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 "23"Output: ["ad", "ae", "af", "bd", "be", &q 阅读全文
posted @ 2012-09-20 03:29 ETCOW 阅读(448) 评论(0) 推荐(0) 编辑
摘要: 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 defined as a character sequence consists of non-space characters only.For example, Given s = "He 阅读全文
posted @ 2012-09-19 05:42 ETCOW 阅读(262) 评论(0) 推荐(0) 编辑
摘要: Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width of each bar is 1, given height = [2,1,5,6,2,3].The largest rectangle is shown in the shaded area, which has 阅读全文
posted @ 2012-09-15 00:17 ETCOW 阅读(516) 评论(2) 推荐(0) 编辑
摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal is to reach the last index in the minimum number of jumps.For example:Given array A = [2,3,1,1,4]The minimum 阅读全文
posted @ 2012-09-14 22:39 ETCOW 阅读(366) 评论(0) 推荐(0) 编辑
摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you are able to reach the last index.For example:A = [2,3,1,1,4], return true.A = [3,2,1,0,4], return fals 阅读全文
posted @ 2012-09-13 22:18 ETCOW 阅读(259) 评论(0) 推荐(0) 编辑
摘要: Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999. 1 static string[] D1 = { "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX" }; 2 static string[] D1 阅读全文
posted @ 2012-09-13 22:06 ETCOW 阅读(389) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 下一页