Code in JAVA || EasyPeasy ✅
\n\n\n# Approach\nThis code implements a solution to concatenate an array of integers. It takes in an array nums of length n as input, and returns an array of l
\n\n\n# Approach\nThis code implements a solution to concatenate an array of integers. It takes in an array nums of length n as input, and returns an array of length 2n that is a concatenation of nums.\n\nThe approach used in the code is simple:\n1. Create an array ans of length 2n to store the concatenated values.\n2. Use a for loop to iterate through the input array nums.\n3. For each iteration, set the current value of nums at index i to the current index i of the ans array.\n4. Set the value of nums at index i to the index i + n of the ans array.\n5. Repeat the above steps for all elements of nums.\n6. Return the ans array as the concatenated result.\n\n\n# Complexity\n- Time complexity:\nThe time complexity of this code is O(n), where n is the length of the input array nums. This is because the code performs a single for loop through the nums array, which takes O(n) time.\n\n\n\n- Space complexity:\nThe space complexity of this code is O(n), as it creates an array ans of length 2n to store the concatenated values. The space used by the code is proportional to the size of the input array, so the space complexity is O(n).\n\n# Code\n```\nclass Solution {\n    public int[] getConcatenation(int[] nums) {\n        int n = nums.length;\n        int ans[] = new int[2*n];\n        for(int i=0;i<n;i++){\n            ans[i] = nums[i];\n            ans[i+n] = nums[i];\n        }\n        return ans;\n    }\n}\n```\n
['Array', 'Java']