Leetcode-Question-251: Flatten 2D Vector

原文链接:

https://leetcode.com/problems/flatten-2d-vector/

题目描述:

Implement an iterator to flatten a 2d vector.

For example,
Given 2d vector =

By calling next repeatedly until hasNext returns false, the order of elements returned by next should be: [1,2,3,4,5,6].

Follow up:
As an added challenge, try to code it using only iterators in C++ or iterators in Java.

解析:

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注