pub struct Solution; impl Solution { pub fn build_array(nums: Vec) -> Vec { nums.iter().map(|&val| nums[val as usize]).collect() } }