Skip to content

Commit 8de91cc

Browse files
committed
Sync LeetCode submission - Build Array from Permutation (rust)
1 parent c632fdb commit 8de91cc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
impl Solution {
2+
pub fn build_array(nums: Vec<i32>) -> Vec<i32> {
3+
let mut v = Vec::with_capacity(nums.len());
4+
5+
for n in nums.iter() {
6+
v.push(nums[*n as usize])
7+
}
8+
9+
v
10+
}
11+
12+
}

0 commit comments

Comments
 (0)