1920.cpp (254B)
1 class Solution { 2 public: 3 vector<int> buildArray(const vector<int> &nums) const { 4 const int n = size(nums); 5 vector<int> res(n, 0); 6 7 for (int i = 0; i < n; i++) 8 res[i] = nums[nums[i]]; 9 return res; 10 } 11 };