Input: nums = [1,2,1]
Output: [1,2,1,1,2,1]
Explanation: The array ans is formed as follows:
class Solution {
public int[] getConcatenation(int[] nums) {
int[] res = new int[nums.length*2];
for(int i=0; i<nums.length; i++){
res[i] = nums[i]; //storing all elements in res[] array
res[i+nums.length] = res[i]; // res[] array is twice the size of nums,
}
return res;
}
}