Google Interview Question

Just some hints. Iterator of Iterators. HashMap. Subsets. Binary Tree.