Skip to content

Commit 936e3af

Browse files
Leetcode 1929
1 parent 1ac1a6d commit 936e3af

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Concatenation_of_Array_1929.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package leetcode;
2+
3+
import java.util.Arrays;
4+
5+
class Solution1929 {
6+
public int[] getConcatenation(int[] nums) {
7+
int[] ans = new int[2 * nums.length];
8+
for (int i = 0; i < nums.length; i++) {
9+
ans[i] = nums[i];
10+
ans[nums.length + i] = nums[i];
11+
}
12+
return ans;
13+
}
14+
}
15+
16+
public class Concatenation_of_Array_1929 {
17+
18+
public static void main(String[] args) {
19+
Solution1929 ns = new Solution1929();
20+
// int[] nums= {1,2,1};
21+
int[] nums = { 1, 3, 2, 1 };
22+
System.out.println(Arrays.toString(ns.getConcatenation(nums)));
23+
}
24+
25+
}

0 commit comments

Comments
 (0)