← All problemsSign in

3925. Concatenate Array With Reverse

LeetCodeArraySimulationOpen on judge ↗

You are given an integer array nums of length n. Construct a new array ans of length 2 * n such that the first n elements are the same as nums, and the next n elements are the elements of nums in reverse order. Formally, for 0 <= i <= n - 1: - ans[i] = nums[i] - ans[i + n] = nums[n - i - 1] Return an integer array ans. Example 1: Input: nums = [1,2,3] Output: [1,2,3,3,2,1] Explanation:

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start