Size vs Capacity Tracker
You are given an integer N, followed by N integers.
- Take input of N elements
- Insert elements into a vector using push_back()
- After each insertion, print:
- Current size
- Current capacity
Example 1:
Input: nums = [1, 2, 3]
Output =
1 1
2 2
3 4
Example 2:
Input: nums = [10, 20, 30, 40, 50]
Output =
1 1
2 2
3 4
4 4
5 8
Now Your Turn!
Pick the correct output for the given inputInput: nums = [-10, 1, 0]
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 <= 50
- -100 <= nums[i] <= 100