摘要: 方法一: 坐等左边右边来送结果~~~,适合所有二叉树 方法二 Branch pruning : 转来自老铁的博客https://home.cnblogs.com/u/davidnyc 阅读全文
posted @ 2018-03-02 13:51 mayinmiao 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 这道题目,一刷用Queue就可以了 阅读全文
posted @ 2018-03-02 12:41 mayinmiao 阅读(83) 评论(0) 推荐(0) 编辑
摘要: 方法一: 双指针容易点。 方法二: 数个数 阅读全文
posted @ 2018-03-02 12:16 mayinmiao 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 这道题目恶心就在于,你要判断k跟list长度之间的大小关系。 所以要先求长度。 阅读全文
posted @ 2018-03-02 11:34 mayinmiao 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 小细节太多了,需要注意!!! 阅读全文
posted @ 2018-03-02 10:59 mayinmiao 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 相同的时候,prev指针不动,cur.next = cur.next.next 不相同的时候, prev跟cur指针同时更新。 阅读全文
posted @ 2018-03-02 08:48 mayinmiao 阅读(104) 评论(0) 推荐(0) 编辑
摘要: Here, I used a helper function to help me get the tail node of duplicate number list. Store the prev and tail node. cur.next != null && cur.next.next 阅读全文
posted @ 2018-03-02 08:41 mayinmiao 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 需要两个dummy node来构造两个list: 一个是小于target的linked list 另一个是大于等于target的linked list 阅读全文
posted @ 2018-03-02 08:08 mayinmiao 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution { 2 public ListNode insert(ListNode head, int value) { 3 // Write your solution here 4 if (head == null) { 5 return new ListNode(value); 6 ... 阅读全文
posted @ 2018-03-02 07:59 mayinmiao 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 注意: merge的时候,cur1更新的位置不再是cur.next, 而是cur.next.next. 思考方式: (1) First, split the list into two sublists, using two pointers: fast and slow; Middle node 阅读全文
posted @ 2018-03-02 07:45 mayinmiao 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 要点: 1. 出了第一个while loop后,要先判断fast指针的情况。 阅读全文
posted @ 2018-03-02 07:25 mayinmiao 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 用到了两个dummy node。 阅读全文
posted @ 2018-03-02 07:09 mayinmiao 阅读(86) 评论(0) 推荐(0) 编辑