摘要: Wiggle Sort II 要点:这题就是关于如何按序插入,基本的logic这个帖子介绍的很清楚:https://leetcode.com/discuss/76965/3 lines python with explanation proof。简单的方法就是先排序,O(nlgn)。python可以 阅读全文
posted @ 2016-06-29 04:04 absolute100 阅读(90) 评论(0) 推荐(0) 编辑
摘要: Top K Frequent Elements 要点: java: PriorityQueue的definition:Comparator:是一个generic interface,所以new Comparator():加括号表示,同时implement interface 用 {}。内部实现@Ov 阅读全文
posted @ 2016-06-29 04:04 absolute100 阅读(86) 评论(0) 推荐(0) 编辑
摘要: Flatten Nested List Iterator 要点:题的本质是建立next和isInteger/getList/getInteger的关系,考点和tree的遍历类似:用stack存dfs的trace,这样可以backtrack到之前层的结点。 注意NestedInteger类的表示,清楚 阅读全文
posted @ 2016-06-29 04:03 absolute100 阅读(143) 评论(0) 推荐(0) 编辑