👏Beats 96.38% of users with Java || ✅Easy & Simple Well Explained Solution 🔥💥
Intuition\nAdd all elements of array nums in ans array and add 2nd time nums in to the ans.\n\n# I Think This Can Help You\n\n\n\n# Approach\n1. Initilize array
# Intuition\nAdd all elements of array nums in ans array and add 2nd time nums in to the ans.\n\n# I Think This Can Help You\n![Screenshot 2024-02-24 232407.png](https://assets.leetcode.com/users/images/628edd47-d74d-43df-ad15-48870227053a_1710936212.3079512.png)\n\n\n# Approach\n1. Initilize array ans of size nums.length * 2.\n2. Run a loop from nums.length to ans.length.\n3. i-nums.length of ans Add i-nums.length of nums to the th index.\n4. Add i-nums.length of nums to the i th index of ans.\n5. return ans.\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\n    public int[] getConcatenation(int[] nums) {\n        int[] ans = new int[nums.length*2];   // Initilize array ans of size nums.length * 2.\n        for(int i=nums.length;i<ans.length;i++){   // Run a loop from nums.length to ans.length.\n             ans[i-nums.length] = nums[i-nums.length];   // i-nums.length of ans Add i-nums.length of nums to the th index.\n             ans[i] = nums[i-nums.length];   // Add i-nums.length of nums to the i th index of ans.\n        }\n        return ans;   // return ans.\n    }\n}\n```\n\n![_94f47172-0dce-4692-964c-6b3dfe96ce1b.jpeg](https://assets.leetcode.com/users/images/80cba419-67b9-4a70-a1b7-e96c1d06e645_1710936632.7364104.jpeg)\n
['Array', 'Simulation', 'Java']