Skip to content

Commit 4a37f96

Browse files
authored
Merge pull request #2658 from codewithsatyam/main
Create: 1929-Concatenation-of-Array.dart
2 parents d8b8359 + 4b35f5c commit 4a37f96

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

dart/1929-concatenation-of-array.dart

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Time Complexity: O(n)
2+
// Space Complexity: O(n)
3+
4+
class Solution {
5+
List<int> getConcatenation(List<int> nums) {
6+
List<int> ans = List<int>.filled(2 * nums.length, 0);
7+
for (int i = 0; i < nums.length; i++) {
8+
ans[i] = nums[i];
9+
ans[i + nums.length] = nums[i];
10+
}
11+
return ans;
12+
}
13+
14+
115
class Solution {
216
List<int> getConcatenation(List<int> nums) {
317
return nums + nums;

0 commit comments

Comments
 (0)