251. Flatten 2D Vector
Approach 1: Store all elements in a new List
If we store all the elements in vec2d
in a single 1D array and iterate over the array we can easily solve this problem.
Time Complexity: O(N), where N = sum(length of all lists in vec2d)
Space Complexity: O(N), where N = sum(length of all lists in vec2d)
Last updated