8000
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.
2 parents 8dd681c + ae2a0d1 commit df1a349Copy full SHA for df1a349
algorithms/cpp/intersectionOfTwoArrays/intersectionOfTwoArrays.cpp
@@ -22,7 +22,7 @@ class Solution {
22
for(int i = 0; i < nums1.size(); i++)
23
inter1.insert(nums1[i]);//get all of the unique elements in nums1 sorted
24
for(int i = 0; i < nums2.size(); i++)
25
- if(inter1.find(nums2[i]) != inter1.end())//search nums1 in O(logN)
+ if(inter1.find(nums2[i]) != inter1.end())//search inter1 in O(logN)
26
inter2.insert(nums2[i]);//populate the intersection set
27
for(set<int>::iterator it = inter2.begin(); it != inter2.end(); ++it)
28
solution.push_back(*it);//copy the set into a vector
0 commit comments