Daily Archives: September 24, 2015


[leetcode] Peeking Iterator

Peeking Iterator Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation — it essentially peek() at the element that will be returned by the next call to next(). Here is an example. Assume that the iterator is initialized to […]


How to Generate a Maze in C++ 2

Generating maze is amazing! This algorithm is also widely used in lots of computer games. Given a 2D array, generate a maze in it. There are several requirements of this maze: There are no circles in the maze, which means all roads in the maze lead to an dead end or to […]