Leetcode 0251. Flatten 2D Vector
Posted on Fri 22 November 2024 in Leetcode Premium • Tagged with iterator
Question Link : https://leetcode.com/problems/flatten-2d-vector/
Difficulty: Medium
Premium: True
Question
Design an iterator to flatten a 2D vector. It should support the next and hasNext operations. Implement the Vector2D class:
Vector2D(int[][] vec) initializes the object with the 2D vector vec. next() returns the next element from the …
Continue reading