commit 8a6f09d0f4ac26b58d1a0779de9d54a243f1964f
parent 97285c339642cfaa840f23b1f9e9b317ca56f9b8
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date: Mon, 12 Aug 2024 21:33:53 +0200
1 Random Problem
Diffstat:
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/Problems/1920.cpp b/Problems/1920.cpp
@@ -0,0 +1,11 @@
+class Solution {
+ public:
+ vector<int> buildArray(const vector<int> &nums) const {
+ const int n = size(nums);
+ vector<int> res(n, 0);
+
+ for (int i = 0; i < n; i++)
+ res[i] = nums[nums[i]];
+ return res;
+ }
+};
diff --git a/README.md b/README.md
@@ -1027,6 +1027,7 @@ for solving problems.
| 1911 | Medium | [Maximum Alternating Subsequence Sum](Problems/1911.cpp) |
| 1913 | Easy | [Maximum Product Difference Between Two Pairs](Problems/1913.cpp) |
| 1915 | Medium | [Number of Wonderful Substrings](Problems/1915.cpp) |
+| 1920 | Easy | [Build Array from Permutation](Problems/1920.cpp) |
| 1921 | Medium | [Eliminate Maximum Number of Monsters](Problems/1921.cpp) |
| 1926 | Medium | [Nearest Exit from Entrance in Maze](Problems/1926.cpp) |
| 1929 | Easy | [Concatenation of Array](Problems/1929.cpp) |