LeetCode 1920. Build Array from Permutation Posted on 2021-07-05 Edited on 2024-11-24 In LeetCode 123456789class Solution {public: vector<int> buildArray(vector<int>& nums) { int n = nums.size(); vector<int> ans(n); for (int i = 0; i < n; ++i) ans[i] = nums[nums[i]]; return ans; }};