-
Notifications
You must be signed in to change notification settings - Fork 0
1920_BuildArrayfromPermutation
a920604a edited this page Apr 14, 2023
·
1 revision
class Solution {
public:
vector<int> buildArray(vector<int>& nums) {
int n= nums.size();
vector<int> ret;
for(int i=0;i<n;++i){
ret.push_back(nums[nums[i]]);
}
return ret;
}
};
- time complexity
O(n)
- space complexity
O(n)
footer