Skip to content

Commit 921a7e8

Browse files
authored
Create Concatenation of Array.java
1 parent ee0c89b commit 921a7e8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Easy/Concatenation of Array.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution {
2+
public int[] getConcatenation(int[] nums) {
3+
int[] ans = new int[nums.length * 2];
4+
for (int i = 0; i < nums.length; i++) {
5+
ans[i + nums.length] = ans[i] = nums[i];
6+
}
7+
return ans;
8+
}
9+
}

0 commit comments

Comments
 (0)