Java | Runtime : 1ms | Beats 100.00% of users with Java
Intuition\n Describe your first thoughts on how to solve this problem. \nSimply copy numbers from an array to another array.\n\n# Approach\n Describe your appro
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nSimply copy numbers from an array to another array.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. Initialize an array with double the size of the input array.\n2. Copy the numbers from input array to resultant array.\n3. Use modulo (%) for cycling through the indix of input array.\n\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java\nclass Solution {\n    public int[] getConcatenation(int[] nums) {\n        // Initialize an array with double the size of the input array.\n        int[] resultantArr = new int[2*nums.length];\n        // Copy the numbers from input array to resultant array.\n        for(int i = 0; i < resultantArr.length; i++) {\n            // Use modulo (%) for cycling through the indix of input array.\n            resultantArr[i] = nums[i%nums.length];\n        }\n        return resultantArr;\n    }\n}\n```
['Java']