1929 - return [ ...A, ...A ]
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n\nIn contest\nwriting code was 5 secs\nbut to read question, write code, 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n\nIn contest\nwriting code was `5 secs`\nbut to read question, write code, test and submit, it was `1 min 21 secs`, losing many ranks :)\n\n- Question asks to, repeat once more, the elements in array into it/ other\n- `...A` will give all elements from array\n- `...A, ...A` will give all elements from array, 2 times\n- `[ ...A, ...A ]` will give all elements from array, 2 times, but constructed into an array\n  - return this as answer\n\nHope it is simple to understand.\n\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n\n---\n\n```\nvar getConcatenation = function(A) {\n    return [ ...A, ...A ]\n};\n```\n\n---\n**132 ms**\n\n![image](https://assets.leetcode.com/users/images/e0d77e96-2ec4-4c44-ac53-277194c3b8a1_1625977550.990095.png)\n\n---\n\n```\nvar getConcatenation = function (nums) {\n    return [...nums, ...nums];\n};\n```\n\n---\n\n```\nvar getConcatenation = function (nums) {\n  const n = nums.length\n  let ans = []\n  for (let i = 0; i < n; i++) {\n    ans[i] = nums[i]\n    ans[i + n] = nums[i]\n  }\n  return ans\n};\n```\n\n---\n\n```\nvar getConcatenation = function (nums) {\n  let ans = [...nums, ...nums]\n  return ans\n};\n```\n\n---\n\n```\nvar getConcatenation = function (nums) {\n  let n = nums.length\n  let ans = []\n  for (let i = 0; i < n; i++) {\n    ans.push(nums[i])\n  }\n  for (let i = 0; i < n; i++) {\n    ans.push(nums[i])\n  }\n  return ans\n};\n```\n\n---\n\n```\nvar getConcatenation = function (nums) {\n  let n = nums.length\n  let ans = []\n  for (let i = 0; i < n; i++) {\n    ans.push(nums[i])\n  }\n  for (let i = 0; i < n; i++) {\n    ans.push(nums[i])\n  }\n  return ans\n};\n```\n\n---\n\n```\nvar getConcatenation = function (nums) {\n  let n = nums.length\n  let ans = []\n\n  let count = 2\n  while (count > 0) {\n    for (let i = 0; i < n; i++) {\n      ans.push(nums[i])\n    }\n    count--\n  }\n\n  return ans\n};\n```\n\n---\n\n```\nvar getConcatenation = function (nums) {\n  let ans = []\n  let count = 2\n  while (count > 0) {\n    ans = nums.reduce((ans2, ele) => {\n      ans2.push(ele)\n      return ans2\n    }, ans)\n    count--\n  }\n  return ans\n};\n```\n\n---\n\n```\nvar getConcatenation = function (nums) {\n  const ans = []\n  let count = 2\n  while (count > 0) {\n    nums.forEach((ele) => ans.push(ele))\n    count--\n  }\n  return ans\n};\n\n```\n
['JavaScript']