We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f59d61 commit 5938a8dCopy full SHA for 5938a8d
4.hash-map/intersection-of-two-arrays/step1.cpp
@@ -1,10 +1,10 @@
1
-#include <unordered_set>
+#include <set>
2
3
class Solution {
4
public:
5
std::vector<int> intersection(std::vector<int>& nums1, std::vector<int>& nums2) {
6
- std::unordered_set<int> seen_in_nums1;
7
- std::unordered_set<int> seen_in_nums2;
+ std::set<int> seen_in_nums1;
+ std::set<int> seen_in_nums2;
8
for (int num : nums1) {
9
seen_in_nums1.insert(num);
10
}
0 commit comments