Tap here to switch tabs
Problem
Submissions

Problem: Concatenation of Array

Concatenation of Array gives you an integer array and asks you to return a new array containing the original sequence twice, back to back.

Statement

Given an integer array nums of length n, construct an array ans of length 2n2n such that ans[i] == nums[i] and ans[i + n] == nums[i] for 0≤0 \leq i << n (0-indexed).

In other words, ans is formed by appending nums to itself.

Return the array ans.

Constraints:

  • n ==== nums.length

  • 1≤1 \leq n ≤103\leq 10^3

  • 1≤1 \leq nums[i] ≤103\leq 10^3

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Concatenation of Array

Concatenation of Array gives you an integer array and asks you to return a new array containing the original sequence twice, back to back.

Statement

Given an integer array nums of length n, construct an array ans of length 2n2n such that ans[i] == nums[i] and ans[i + n] == nums[i] for 0≤0 \leq i << n (0-indexed).

In other words, ans is formed by appending nums to itself.

Return the array ans.

Constraints:

  • n ==== nums.length

  • 1≤1 \leq n ≤103\leq 10^3

  • 1≤1 \leq nums[i] ≤103\leq 10^3