1929. Concatenation of Array Easy

@problem@discussion
#Array



1/**
2 * [1929] Concatenation of Array
3 *
4 * Given an integer array nums of length n, you want to create an array ans of length 2n where ans[i] == nums[i] and ans[i + n] == nums[i] for 0 <= i < n (0-indexed).
5 * Specifically, ans is the concatenation of two nums arrays.
6 * Return the array ans.
7 *  
8 * Example 1:
9 * 
10 * Input: nums = [1,2,1]
11 * Output: [1,2,1,1,2,1]
12 * Explanation: The array ans is formed as follows:
13 * - ans = [nums[0],nums[1],nums[2],nums[0],nums[1],nums[2]]
14 * - ans = [1,2,1,1,2,1]
15 * Example 2:
16 * 
17 * Input: nums = [1,3,2,1]
18 * Output: [1,3,2,1,1,3,2,1]
19 * Explanation: The array ans is formed as follows:
20 * - ans = [nums[0],nums[1],nums[2],nums[3],nums[0],nums[1],nums[2],nums[3]]
21 * - ans = [1,3,2,1,1,3,2,1]
22 * 
23 *  
24 * Constraints:
25 * 
26 * 	n == nums.length
27 * 	1 <= n <= 1000
28 * 	1 <= nums[i] <= 1000
29 * 
30 */
31pub struct Solution {}
32
33// problem: https://leetcode.com/problems/concatenation-of-array/
34// discuss: https://leetcode.com/problems/concatenation-of-array/discuss/?currentPage=1&orderBy=most_votes&query=
35
36// submission codes start here
37
38impl Solution {
39    pub fn get_concatenation(nums: Vec<i32>) -> Vec<i32> {
40        vec![]
41    }
42}
43
44// submission codes end
45
46#[cfg(test)]
47mod tests {
48    use super::*;
49
50    #[test]
51    fn test_1929() {
52    }
53}
54


Back
© 2025 bowen.ge All Rights Reserved.