File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 212
212
1672|[ Richest Customer Wealth] ( ./1672-richest-customer-wealth.js ) |Easy|
213
213
1780|[ Check if Number is a Sum of Powers of Three] ( ./1780-check-if-number-is-a-sum-of-powers-of-three.js ) |Medium|
214
214
1880|[ Check if Word Equals Summation of Two Words] ( ./1880-check-if-word-equals-summation-of-two-words.js ) |Easy|
215
+ 1920|[ Build Array from Permutation] ( ./1920-build-array-from-permutation.js ) |Easy|
215
216
1929|[ Concatenation of Array] ( ./1929-concatenation-of-array.js ) |Easy|
216
217
1935|[ Maximum Number of Words You Can Type] ( ./1935-maximum-number-of-words-you-can-type.js ) |Easy|
217
218
1996|[ The Number of Weak Characters in the Game] ( ./1996-the-number-of-weak-characters-in-the-game.js ) |Medium|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 1920. Build Array from Permutation
3
+ * https://leetcode.com/problems/build-array-from-permutation/
4
+ * Difficulty: Easy
5
+ *
6
+ * Given a zero-based permutation nums (0-indexed), build an array ans of the same length
7
+ * where ans[i] = nums[nums[i]] for each 0 <= i < nums.length and return it.
8
+ *
9
+ * A zero-based permutation nums is an array of distinct integers from 0 to nums.length - 1
10
+ * (inclusive).
11
+ */
12
+
13
+ /**
14
+ * @param {number[] } nums
15
+ * @return {number[] }
16
+ */
17
+ var buildArray = function ( nums ) {
18
+ return nums . map ( n => nums [ n ] ) ;
19
+ } ;
You can’t perform that action at this time.
0 commit comments