15. leetcode 349. Intersection of Two Arrays

Given two arrays, write a function to compute their intersection.

Example:
Given nums1 = [1, 2, 2, 1]nums2 = [2, 2], return [2].

Note:

  • Each element in the result must be unique.
  • The result can be in any order.

思路:利用 C++ 中的set 容器。

 

posted @ 2017-04-09 21:33  蓦然闻声  阅读(115)  评论(0编辑  收藏  举报