10 2015 档案

摘要:This problem seems to be easy at the first glance, especially the problem gives a too much simpler example. Make sure you understand the problem by ma... 阅读全文
posted @ 2015-10-31 18:23 jianchao-li 阅读(348) 评论(0) 推荐(0) 编辑
摘要:Problem Description:Given a binary tree, find the length of the longest consecutive sequence path.The path refers to any sequence of nodes from some s... 阅读全文
posted @ 2015-10-30 16:55 jianchao-li 阅读(2280) 评论(0) 推荐(0) 编辑
摘要:I adopt a way similar to that of the OJ to serialize the binary tree. For the following tree, my serialization result is "1,2,3,null,null,4,5," (note ... 阅读全文
posted @ 2015-10-30 15:51 jianchao-li 阅读(845) 评论(0) 推荐(0) 编辑
摘要:Problem Description:A group of two or more people wants to meet and minimize the total travel distance. You are given a 2D grid of values 0 or 1, wher... 阅读全文
posted @ 2015-10-22 16:34 jianchao-li 阅读(3869) 评论(0) 推荐(1) 编辑
摘要:This post shares a very nice solution using two heaps: a max heap for the smaller half and a min heap for the larger half. The code is rewritten below... 阅读全文
posted @ 2015-10-19 23:53 jianchao-li 阅读(1605) 评论(0) 推荐(0) 编辑
摘要:Problem Description:You are playing the following Flip Game with your friend: Given a string that contains only these two characters:+and-, you and yo... 阅读全文
posted @ 2015-10-17 00:20 jianchao-li 阅读(6522) 评论(0) 推荐(0) 编辑
摘要:Problem Description:You are playing the following Flip Game with your friend: Given a string that contains only these two characters:+and-, you and yo... 阅读全文
posted @ 2015-10-15 13:54 jianchao-li 阅读(6192) 评论(0) 推荐(0) 编辑
摘要:Haha, an interesting problem. Just try to let your opponent start with a number that is an integer multiple of 4.1 class Solution {2 public:3 bool... 阅读全文
posted @ 2015-10-13 16:41 jianchao-li 阅读(207) 评论(0) 推荐(0) 编辑
摘要:Problem Description:Given apatternand a stringstr, find ifstrfollows the same pattern.Herefollowmeans a full match, such that there is a bijection bet... 阅读全文
posted @ 2015-10-12 00:08 jianchao-li 阅读(5000) 评论(0) 推荐(0) 编辑
摘要:This problem can be solved in very neat codes (yeah, you will see Stefan posting many nice solutions).The solution in the above link is so nice that I... 阅读全文
posted @ 2015-10-06 22:10 jianchao-li 阅读(421) 评论(0) 推荐(0) 编辑
摘要:A solution using additional spaces to solve a copy of the original board is easy. To get an in-place solution, we need to record the information of st... 阅读全文
posted @ 2015-10-04 00:59 jianchao-li 阅读(699) 评论(0) 推荐(0) 编辑
摘要:Problem Description:An abbreviation of a word follows the form . Below are some examples of word abbreviations:a) it --> it (n... 阅读全文
posted @ 2015-10-02 00:30 jianchao-li 阅读(4232) 评论(0) 推荐(0) 编辑