Best and Easy Approach ✅ || Beats 90% 🎯
Intuition\n Describe your first thoughts on how to solve this problem. When tasked with creating a new array by concatenating an existing array with itself, the
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->When tasked with creating a new array by concatenating an existing array with itself, the solution involves simply appending the elements of the array to itself. This operation can be achieved efficiently by iterating through the original array and appending its elements to the end.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. **Determine the size of the original array:** Store the size of the original array to know how many elements to iterate over.\n2. **Iterate through the original array:** Loop through the array from the first element to the last.\n2. **Append elements to the array:** During each iteration, append the current element to the end of the array.\n2. **Return the modified array:** After the loop, the array will be twice its original size with the second half being a copy of the first half.\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> getConcatenation(vector<int>& nums) {\n        int size=nums.size();\n        for(int i=0;i<size;i++)\n            nums.push_back(nums[i]);\n        return nums;\n    }\n};\n```
['C++']