Skip to content

Commit 79d022c

Browse files
Create array_from_permutation.js
1 parent 27cf8fc commit 79d022c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

array_from_permutation.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @param {number[]} nums
3+
* @return {number[]}
4+
*/
5+
var buildArray = function(nums) {
6+
let arr = [];
7+
8+
for(let i = 0; i < nums.length; i++) {
9+
arr.push(nums[nums[i]])
10+
}
11+
12+
return arr;
13+
};

0 commit comments

Comments
 (0)