2014年(53)
发布时间:2014-09-18 15:36:24
Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [ ["aa","b"],.........【阅读全文】
发布时间:2014-09-18 10:06:09
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer to string, note the restriction of using extra space.You could also t.........【阅读全文】
发布时间:2014-09-18 09:42:39
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 palindrome.Note:Have you consider that the string might be empty? This is a.........【阅读全文】
发布时间:2014-09-16 16:19:17
我们先研究一下这个问题,判断一个字符串s3是否由给定的字符串s1和s2交错而成:由于s1和s2中可能有相同的字符,所以无法通过遍历s3得出结论。那看一下是否有最优子结构?也就是说,问题的解是否可以由子问题的解推导出来。假设s3的长度为l3,首先想到的是result[l3]=result[l3-1]&&(s3[l3-1]在s1或s2中);后.........【阅读全文】
发布时间:2014-09-06 13:50:01
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 number of ways to decode it.For example,Given encoded message "12", it could be dec.........【阅读全文】