We’re preparing your current view and syncing the latest data.
You are given an integer array nums of length n. You need to create a new array of length 2n where the first n elements are identical to nums and the last n elements are also identical to nums. Return the resulting array.
Example: Input: nums = [1,2,1] Output: [1,2,1,1,2,1]
An integer array nums of length n.
An integer array of length 2n that consists of nums followed by nums.
1 <= n <= 1000 1 <= nums[i] <= 1000
Example 1
Input
nums = [1,2,1]
Output
[1,2,1,1,2,1]
Explanation
The output array consists of the original array followed by itself.