@@ -33,7 +33,7 @@ The result can be in any order.
3333
3434## 关键点解析
3535
36- 无
36+ - 空间换时间
3737
3838## 代码
3939
@@ -42,46 +42,6 @@ The result can be in any order.
4242Javascript Code:
4343
4444``` js
45- /*
46- * @lc app=leetcode id=349 lang=javascript
47- *
48- * [349] Intersection of Two Arrays
49- *
50- * https://leetcode.com/problems/intersection-of-two-arrays/description/
51- *
52- * algorithms
53- * Easy (53.11%)
54- * Total Accepted: 203.6K
55- * Total Submissions: 380.9K
56- * Testcase Example: '[1,2,2,1]\n[2,2]'
57- *
58- * Given two arrays, write a function to compute their intersection.
59- *
60- * Example 1:
61- *
62- *
63- * Input: nums1 = [1,2,2,1], nums2 = [2,2]
64- * Output: [2]
65- *
66- *
67- *
68- * Example 2:
69- *
70- *
71- * Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4]
72- * Output: [9,4]
73- *
74- *
75- * Note:
76- *
77- *
78- * Each element in the result must be unique.
79- * The result can be in any order.
80- *
81- *
82- *
83- *
84- */
8545/**
8646 * @param {number[]} nums1
8747 * @param {number[]} nums2
@@ -128,3 +88,13 @@ class Solution:
12888 def intersection (self , nums1 : List[int ], nums2 : List[int ]) -> List[int ]:
12989 return set (nums1) & set (nums2)
13090```
91+ ** 复杂度分析**
92+ - 时间复杂度:$O(N)$
93+ - 空间复杂度:$O(N)$
94+
95+ 更多题解可以访问我的LeetCode题解仓库:https://github.com/azl397985856/leetcode 。 目前已经35K star啦。
96+
97+ 关注公众号力扣加加,努力用清晰直白的语言还原解题思路,并且有大量图解,手把手教你识别套路,高效刷题。
98+
99+
100+ ![ ] ( https://tva1.sinaimg.cn/large/007S8ZIlly1gfcuzagjalj30p00dwabs.jpg )
0 commit comments