Skip to content

Commit 655f90c

Browse files
authored
Merge pull request #2432 from galfudim/gfudim-rust-1929
Create: 1929-concatenation-of-array.rs
2 parents 6dc5da1 + 3deb30a commit 655f90c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

rust/1929-concatenation-of-array.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
impl Solution {
2+
pub fn get_concatenation(nums: Vec<i32>) -> Vec<i32> {
3+
let n = nums.len();
4+
let mut ans = vec![0; 2 * n];
5+
6+
for i in 0..nums.len() {
7+
ans[i] = nums[i];
8+
ans[i + n] = nums[i];
9+
}
10+
11+
ans
12+
}
13+
}

0 commit comments

Comments
 (0)