随笔分类 - leetcode-recursion
摘要:Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation ofs1="great": great / \ gr eat / \ / \g r e at / \ a tTo scramble the string, we may choose any non-leaf no...
阅读全文
posted @ 2014-02-06 14:48
krunning
摘要: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 the entire input string (not partial).The function prototype should be:bool i
阅读全文
posted @ 2014-02-06 14:15
krunning
摘要:Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()()" 1 public class Solution { 2 public ArrayList generateParen
阅读全文
posted @ 2014-02-06 05:35
krunning
摘要: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 string (not partial).The function prototype should be:bool isMatch(const char
阅读全文
posted @ 2014-02-06 04:59
krunning
摘要:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). 1 public class Solution { 2 public double findMedianSortedArrays(int A[], int B[]) { 3 int len1 = A.length; 4 int le...
阅读全文
posted @ 2014-02-06 04:52
krunning
浙公网安备 33010602011771号