Loading...
Loading...
Given an integer array nums of length n, return an array ans of length 2n where for all 0 <= i < n:
ans[i] == nums[i]ans[i + n] == nums[i]In other words, ans is the concatenation of two nums arrays.
Input: Array nums of length n.
Output: Array of length 2n — nums concatenated with itself.
Input: nums = [1,2,1] → Output: [1,2,1,1,2,1]
Input: nums = [1,3,2,1] → Output: [1,3,2,1,1,3,2,1]
ans of size 2n. Loop i = 0..n-1, set ans[i] = ans[i+n] = nums[i].return nums + nums / nums.concat(nums).n == nums.length 1 <= n <= 1000 1 <= nums[i] <= 1000