Iterators

ZigZag Iterator Implement Zig Zag Iterator that has hasNext() and next() methods that can print values from a list of lists in cyclic order. Array of Index Solution Use an array to keep track of current index of each list. hasNext(): check index array, if there exist any index that hasn’t reach the end, meaning […]