✅Java, PHP, Python, C++, JavaScript || Simple Solution || ✅Runtime 90% ||
Intuition\nThe intuition behind this solution is straightforward. We want to concatenate the given array with itself to create a new array that has the same ele
# Intuition\nThe intuition behind this solution is straightforward. We want to concatenate the given array with itself to create a new array that has the same elements repeated twice.\n\n# Approach\n- We start by initializing an empty list called ans, which we\'ll use to store the concatenated array.\n\n- We iterate through the elements of the input nums array using a for loop. For each element num in nums, we append it to the ans list.\n\n- After the loop, we concatenate the nums array again to the ans list using the += operator. This effectively adds all the elements of nums to the end of ans.\n\n- Finally, we return the ans list, which now contains the concatenated array.\n\n# Complexity\n- Time complexity:\nO(n) - We iterate through the input nums array once, where n is the length of nums.\n\n\n- Space complexity:\nWe use additional space to store the ans list, which has the same length as nums.\n\n# Code\n```\nclass Solution:\n    def getConcatenation(self, nums):\n        # Initialize an empty list to store the concatenated array\n        ans = []\n        \n        # Iterate through the elements of the input \'nums\' array\n        for num in nums:\n            # Append the current number to the \'ans\' list\n            ans.append(num)\n        \n        # Concatenate \'nums\' again to \'ans\' to form the final result\n        ans += nums\n        \n        return ans\n};\n```\n\n![478xve.jpg](https://assets.leetcode.com/users/images/e1a71172-683c-4457-b7f0-bbd3f106121e_1696442693.9413323.jpeg)\n
['PHP', 'Python', 'C++', 'Java', 'JavaScript']