Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 450 Bytes

1929_ConcatenationOfArray.md

File metadata and controls

19 lines (15 loc) · 450 Bytes

O(n) time and O(n) space solution

  • We will use inbuilt function vector.insert() to concatenate the arrays.

Code

class Solution{
public:
    vector<int> getConcatenation(vector<int> &nums)
    {
        vector<int> ans(nums.begin(), nums.end());
        ans.insert(ans.end(), nums.begin(), nums.end());
        return ans;
    }
};