commit e107602f2b2ba9d52f158fb497a94fe08a073750
parent b78de2ac5034da415e829086fc414b0ae53d9e10
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date: Wed, 3 May 2023 11:07:54 +0200
Daily Problem
Diffstat:
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/Problems/2215.cpp b/Problems/2215.cpp
@@ -0,0 +1,13 @@
+class Solution {
+public:
+ vector<vector<int>> findDifference(vector<int> &nums1, vector<int> &nums2) {
+ unordered_set<int> s1(nums1.begin(), nums1.end());
+ unordered_set<int> s2(nums2.begin(), nums2.end());
+ vector<vector<int>> res(2);
+ for (auto num : s1)
+ if (!s2.count(num)) res[0].push_back(num);
+ for (auto num : s2)
+ if (!s1.count(num)) res[1].push_back(num);
+ return res;
+ }
+};
diff --git a/README.md b/README.md
@@ -497,6 +497,7 @@ for solving problems.
| 2181 | Medium | [Merge Nodes in Between Zeros](Problems/2181.cpp) |
| 2187 | Medium | [Minimum Time to Complete Trips](Problems/2187.cpp) |
| 2192 | Medium | [All Ancestors of a Node in a Directed Acyclic Graph](Problems/2192.cpp) |
+| 2215 | Easy | [Find the Difference of Two Arrays](Problems/2215.cpp) |
| 2218 | Hard | [Maximum Value of K Coins From Piles](Problems/2218.cpp) |
| 2235 | Easy | [Add Two Integers](Problems/2235.cpp) |
| 2236 | Easy | [Root Equals Sum of Children](Problems/2236.cpp) |