⚡2 CLEAN SOLUTIONS🗝️| ✅language specific sol⏳ & universally implementable sol🌌)| BEATS 💯
Complexity
Time Complexity: O(log x)
Space Complexity: O(1)
CodeWITHOUT USING LANGUAGE SPECIFIC FUCNTIONS

# Complexity
- Time Complexity: `O(log x)`
- Space Complexity: `O(1)`


# Code
```cpp []
class Solution {
public:
    vector<int> getConcatenation(vector<int>& nums) {
        nums.insert(nums.end(), nums.begin(), nums.end());
        return nums;
    }
};
```

```java []
class Solution {
    public int[] getConcatenation(int[] nums) {
        int n = nums.length;
        int[] result = new int[2 * n];
        
        System.arraycopy(nums, 0, result, 0, n);
        System.arraycopy(nums, 0, result, n, n);
        
        return result;
    }
}
```



```python []
class Solution:
    def getConcatenation(self, nums: List[int]) -> List[int]:
        nums.extend(nums)
        return nums
```


```javascript []
/**
 * @param {number[]} nums
 * @return {number[]}
 */
var getConcatenation = function(nums) {
    return [...nums, ...nums];
};

```
---
# WITHOUT USING LANGUAGE SPECIFIC FUCNTIONS
```cpp []
// without insert
class Solution {
public:
    vector<int> getConcatenation(vector<int>& nums) {
        int n = nums.size();
        vector<int> ans(2 * n);
        for (int i = 0; i < n; i++) {
            ans[i] = nums[i];
            ans[i + n] = nums[i];
        }
        return ans;
    }
};
```

```java []
//without arraycopy
class Solution {
    public int[] getConcatenation(int[] nums) {
        int n = nums.length;
        int[] ans = new int[2 * n];
        for (int i = 0; i < n; i++) {
            ans[i] = nums[i];
            ans[i + n] = nums[i];
        }
        return ans;
    }
}
```

```python []
# without extend
class Solution:
    def getConcatenation(self, nums):
        n = len(nums)
        ans = [0] * (2 * n)
        for i in range(n):
            ans[i] = nums[i]
            ans[i + n] = nums[i]
        return ans

```

```javascript []
// common approach
/**
 * @param {number[]} nums
 * @return {number[]}
 */
var getConcatenation = function(nums) {
    let n = nums.length;
    let ans = new Array(2 * n);
    for (let i = 0; i < n; i++) {
        ans[i] = nums[i];
        ans[i + n] = nums[i];
    }
    return ans;
};
```

```
✨ AN UPVOTE WILL BE APPRECIATED ^_~ ✨
```
['Python', 'C++', 'Java', 'Python3', 'JavaScript']