Build a Dynamic Vector
You are given an integer N, followed by N integers.
Your task is to:
- Create an empty vector
- Take input of N elements
- Insert all elements using push_back()
- Print all elements in the same order
Note: Do not add extra space after printing last element, instead move to new line.
Example 1:
Input: nums = [1,2 ,3, 4, 5]
Output: 1 2 3 4 5
Example 2:
Input: nums = [1, -2 ,3 , -4, 5]
Output: 1 -2 3 -4 5
Now Your Turn!
Pick the correct output for the given inputInput: nums = [9, 2, 0, -1, 2]
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= N <= 100
- -100 <= nums[i] <= 100