Facebook | Phone screen | Sorted Iterator
10470

Status: BS CS, 5 Years of Experince
Position: Software Engineer at Facebook
Location: New York, NY
Technical phone screen (1 hour):

Implement a sorted java iterator that returns a sorted list over k sorted lists.

class SortedIterator implements Iterator<Integer> {
	public SortedIterator(List<List<Integer>> lists) {}
	public boolean hasNext() {}
	public Integer next() {}
}

Example:

Input: 
[[1, 4, 5, 8, 9],
 [3, 4, 4, 6],
 [0, 2, 8]]
Output:  0, 1, 2, 3, 4, 4, 4, 5, 6, 8, 8, 9
Comments (15)