3925. Concatenate Array With Reverse
You are given an integer array
numsof lengthn.Construct a new array
ansof length2 * nsuch that the firstnelements are the same asnums, and the nextnelements are the elements ofnumsin reverse order.Formally, for
0 <= i <= n - 1:
ans[i] = nums[i]ans[i + n] = nums[n - i - 1]Return an integer array
ans.
1 | class Solution { |