2017年3月12日

摘要: Good reference for all tree problem https://sites.google.com/site/jennyshelloworld/company-blog/chapter-3 binary-tree-divide-conquer Analysis: Here we 阅读全文
posted @ 2017-03-12 02:48 codingEskimo 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 1. Recursive Straight Forward, left -> right -> root 2. Iterator This is a little bit hard to understand, here is good reference https://sites.google. 阅读全文
posted @ 2017-03-12 02:20 codingEskimo 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 1. Recursive Straight Forward, Add left -> root -> right 2. Iterator 1. Create a node to present current node. 2. If current node is not null and stac 阅读全文
posted @ 2017-03-12 01:54 codingEskimo 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 1. Recursive: Very Straight forward, If the node is not null, add root -> traversal left -> traversal right 2. Iterator(find a very good explanation h 阅读全文
posted @ 2017-03-12 01:30 codingEskimo 阅读(100) 评论(0) 推荐(0) 编辑
摘要: Notice 1. Input String always need to be check whether it is NULL; 2. For the conner cases, source is shorter than the target or target is empty, it c 阅读全文
posted @ 2017-03-12 00:55 codingEskimo 阅读(142) 评论(0) 推荐(0) 编辑

2016年8月20日

摘要: 这道题和Palindrome Partitioning很像,都是怎么切数组的问题,唯一需要注意的是ip的规定 1)不能出现0和其他数字组合, 类似0.00.01.1。0只能单独出现或者在一个片段中不为开头的数字。 2)每一个片段数字最大为255 3)只能有四个片段 4)这里需要注意一个细节: 在这里 阅读全文
posted @ 2016-08-20 04:51 codingEskimo 阅读(262) 评论(0) 推荐(0) 编辑

2016年8月19日

摘要: 这道题是典型的深度优先搜索的问题, 可以多拿出来看看,和我之前做的subset以及permutation不一样的是这道题其实是排列组合中如何切数组的问题[a,a,a,a]-- [a|a|a|a] -> [a|a|aa] -> [a|aa|a] -> [a|aaa] ->[aa|a|a] ->[aa| 阅读全文
posted @ 2016-08-19 09:25 codingEskimo 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 这道题也属于排列组合问题,所以用recursive。属于深度优先的题目。这道题和单纯的subset和permutation略有不同,因为是从不同数字代表的字母中选,而每个数字内部的组合不需要。 在想这道题的时候我们可以先想两个数字,就是从第一个的数字所代表的字母中依次选出,然后和下一个数字代表的字母 阅读全文
posted @ 2016-08-19 06:55 codingEskimo 阅读(148) 评论(0) 推荐(0) 编辑

2016年8月18日

摘要: 这道题比Combination Sum还要简单,因为每个数不能重复使用,所以只需要从下一个开始即可,和subset II一样 阅读全文
posted @ 2016-08-18 08:47 codingEskimo 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 这个题和permutation很像,只是需要考虑重复的数字。重复的数字只有第一次出现的时候加入,保证永远都是第一个重复出现的数字在前,而且要加过(用used数组纪律的时候,重复数字第一个如果没有被mark,就应该跳过)。 阅读全文
posted @ 2016-08-18 08:05 codingEskimo 阅读(116) 评论(0) 推荐(0) 编辑

导航