- We will use inbuilt function
vector.insert()
to concatenate the arrays.
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;
}
};