标签:
Given two arrays, write a function to compute their intersection.
Example:
Given nums1 = [1, 2, 2, 1]
, nums2 = [2, 2]
, return [2, 2]
.
Note:
Follow up:
参考之前Intersection of Two Arrays 这个题,对于follow up, sorted的显然2 pointer更好; size 1 小的话hashtable更好; nums2无法一次取出则表明无法sort,所以也用hashtable。
350. Intersection of Two Arrays II
标签:
原文地址:http://www.cnblogs.com/renyualbert/p/5904823.html