Skip to content

Commit de6b2cb

Browse files
authoredJul 4, 2021
Create 1920-build-array-from-permutation.js
1 parent 24b3960 commit de6b2cb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎1920-build-array-from-permutation.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @param {number[]} nums
3+
* @return {number[]}
4+
*/
5+
const buildArray = function(nums) {
6+
const res = []
7+
for(let i = 0, n = nums.length; i < n; i++) {
8+
res[i] = nums[nums[i]]
9+
}
10+
return res
11+
};

0 commit comments

Comments
 (0)
Please sign in to comment.