摘要: Q: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 ... 阅读全文
posted @ 2013-09-24 23:06 summer_zhou 阅读(225) 评论(0) 推荐(0) 编辑
摘要: Q:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.11is read off as"two 1s"or21.21is read off as"one 2, thenone 1"or1211.Given an integern, generate thenthsequence.Note: The sequence of in 阅读全文
posted @ 2013-09-24 20:35 summer_zhou 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Q:Givens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", return true.Whens3="aadbbbaccc", return false.A: DP题。这道题hulu面试出过,当时sb了,想着用递归做,但是考虑一种极限情况 XXX ,XXX,XXXXXX. 如果递归的话,分支每次要走两个支路,复杂度是 阅读全文
posted @ 2013-09-24 15:55 summer_zhou 阅读(123) 评论(0) 推荐(0) 编辑