Concatenation of Array
这题没啥可说的吧..
1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
class Solution { public int[] getConcatenation(int[] nums) { int n = nums.length; int[] res = new int[2*n]; int i = 0; for(int k : nums) { res[i] = k; res[i + n] = k; i++; } return res; } } |