feat: add initial implementation of Cargo.toml, Cargo.lock, and main function with build_array method

This commit is contained in:
SquidSpirit 2025-08-18 18:15:39 +08:00
parent a442d1cd09
commit ae4d5b5527
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()
}
}