
Iterator
文章平均质量分 73
flyatcmu
这个作者很懒,什么都没留下…
展开
-
Peeking Iterator
Given an Iterator class interface with methods:next()andhasNext(), design and implement a PeekingIterator that support thepeek()operation -- it essentially peek() at the element that will be r原创 2016-09-08 07:48:55 · 349 阅读 · 0 评论 -
Binary Search Tree Iterator
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.Note: next() ...原创 2015-01-11 13:03:24 · 617 阅读 · 0 评论 -
Flatten List
Given a list, each element in the list can be a list or integer. flatten it into a simply list with integers.ExampleExample 1: Input: [[1,1],2,[1,1]] Output: [1,1,2,1,1] Explanation: flatt...原创 2019-12-15 08:04:01 · 167 阅读 · 0 评论 -
Flatten 2D Vector
Implement an iterator to flatten a 2d vector.For example,Given 2d vector =[ [1,2], [3], [4,5,6]]By callingnextrepeatedly untilhasNextreturns false, the order of elements returned原创 2016-09-20 13:46:51 · 489 阅读 · 0 评论 -
纪念一下第二个assignment 100分
感悟就是:坚持,才能从good到great。精益求精就是要不断打磨产品。Princeton的课就是好,一个作业可以牵扯到很多算法。复习了shuffle算法和Resevoir Sampling算法,还有linkedin,array implement deque,iterator的用法,确实不错的课程,经典就是经典!刷题不在乎刷题数目多少,而在于刷背后知识点的深度和广度。加油!我觉得我刷完A...原创 2019-03-29 08:54:32 · 211 阅读 · 0 评论