Tap here to switch tabs
Problem
Ask
Submissions

Problem: Concatenation of Array

med
30 min
Understand how to construct a doubled array by appending an integer array to itself, applying tracking techniques crucial for solving permutations and similar coding problems.

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 00 \leq i << n (0-indexed).

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

Return the array ans.

Constraints:

  • n ==== nums.length

  • 11 \leq n 103\leq 10^3

  • 11 \leq nums[i] 103\leq 10^3

Tap here to switch tabs
Problem
Ask
Submissions

Problem: Concatenation of Array

med
30 min
Understand how to construct a doubled array by appending an integer array to itself, applying tracking techniques crucial for solving permutations and similar coding problems.

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 00 \leq i << n (0-indexed).

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

Return the array ans.

Constraints:

  • n ==== nums.length

  • 11 \leq n 103\leq 10^3

  • 11 \leq nums[i] 103\leq 10^3