![]() |
VOOZH | about |
Given a Vector of Vectors (2D vector), the task is to flatten this 2d vector. Examples:
Input: vector = [[1, 2, 3, 4], [5, 6], [7, 8]] Output: 1 2 3 4 5 6 7 8 Input: vector = [[1, 2], [3], [4, 5, 6, 8]] Output: 1 2 3 4 5 6 8
Algorithm:
Below is the implementation of the above approach:
1 2 3 4 5 6 7 8 9 10
Time Complexity: O(N)
Auxiliary Space: O(N)