Given an integer array nums of length n, you want to create an array ans of length 2n where ans[i] == nums[i] and ans[i + n] == nums[i] for 0 <= i < n (0-indexed).
Specifically, ans is the concatenation of two nums arrays.
Return the array ans.
i
0
0
0
1
0
2
0
3
0
4
0
5
0
6
0
7
n=4
nums=[5, 1, 9, 3]
Step 1 / 6
Step 1:
Allocate ans with length 2n, then fill ans[i] and ans[i+n] in one pass.
Pointers: i=0
Focus: default
n=4