Skip to content

Commit 4a37f96

Browse files
authored
Merge pull request neetcode-gh#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

Lines changed: 14 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy