feat: 1920_build_array_from_permutation

This commit is contained in:
SquidSpirit 2025-08-18 18:15:39 +08:00
parent 476faf16f8
commit c13ac3ca2a
3 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "build_array_from_permutation"
version = "0.1.0"

View File

@ -0,0 +1,6 @@
[package]
name = "build_array_from_permutation"
version = "0.1.0"
edition = "2024"
[dependencies]

View File

@ -0,0 +1,11 @@
fn main() {
println!("Hello, world!");
}
struct Solution;
impl Solution {
pub fn build_array(nums: Vec<i32>) -> Vec<i32> {
nums.iter().map(|&val| nums[val as usize]).collect()
}
}