Skip to content

Commit 6e709a2

Browse files
author
AmiyahJo
committed
feat: adds answer to leetcode 1929
copy & paste solution made from leetcode where I originally submitted
1 parent b01a324 commit 6e709a2

File tree

1 file changed

+10
-1
lines changed
  • lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11

1 file changed

+10
-1
lines changed

lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11/Lesson11.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@ public class Lesson11 {
99
* https://leetcode.com/problems/concatenation-of-array
1010
*/
1111
public int[] getConcatenation(int[] nums) {
12-
return null;
12+
int n = nums.length;
13+
14+
int[] ans = new int[2 * n];
15+
16+
for(int i = 0; i < n; i++){
17+
ans[i] = nums[i];
18+
ans[i + n] = nums[i];
19+
}
20+
21+
return ans;
1322
}
1423

1524
/**

0 commit comments

Comments
 (0)