Intersection of Two Arrays II
@ico-Meng @jack76 Thank you for the info!
Agree, the problem is confusing, doesn't intersection means the same continous sequence other than all the same elements?
@yanchao_hust said in C++ hash table solution and sort + two pointers solution with time and space complexity:
As I said, In a coding interview, output space doesn't count into space complexity.
BTW, I'm also from HUST.
@haggard this is much better
@shawntsai I checked twice too. may be OJ! Yes to 2nd question.
Using a unordered_multiset, hope it helps!
No one has replied
And it does it a lot faster:
@tobelzm I don't think so, for the 2 pointer way, each array will have one pointer and if the pointed values are the same, add it to returned list and move the first pointer, if not, move the second pointer to the next.
Disabled Categories are greyed out
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.