MCPcopy Create free account
hub / github.com/StudyRust/leetcode_rust / get_concatenation

Function get_concatenation

1929-concatenation-of-array.rs:11–16  ·  view source on GitHub ↗

1929 https://leetcode-cn.com/problems/concatenation-of-array/ [1,2,1] [1,2,1,1,2,1] 审题,函数输入已经固定是 immut vec,那么结果不能用他返回 所以需要declare 2 个mut 的nums

(nums: Vec<i32>)

Source from the content-addressed store, hash-verified

9// 审题,函数输入已经固定是 immut vec,那么结果不能用他返回
10// 所以需要declare 2 个mut 的nums
11pub fn get_concatenation(nums: Vec<i32>) -> Vec<i32> {
12 let mut res_nums = nums.clone();
13 let mut clone_nums = nums.clone();
14 res_nums.append(&mut clone_nums); // 只能 append mut 的nums
15 res_nums
16}

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected