1389.cpp (289B)
1 class Solution { 2 public: 3 vector<int> createTargetArray(const vector<int> &nums, const vector<int> &index) const { 4 vector<int> res; 5 6 for (int i = 0; i < size(nums); i++) { 7 res.insert(begin(res) + index[i], nums[i]); 8 } 9 10 return res; 11 } 12 };