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

Function shuffle

1470-shuffle-the-array.rs:17–24  ·  view source on GitHub ↗
(nums: Vec<i32>, n: i32)

Source from the content-addressed store, hash-verified

15}
16
17pub fn shuffle(nums: Vec<i32>, n: i32) -> Vec<i32> {
18 let mut res = vec!();
19 for i in 0..n {
20 res.push(nums[i as usize]);
21 res.push(nums[((i as i32)+n) as usize]);
22 }
23 res
24}

Callers 1

mainFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected