題目出處
349. Intersection of Two Arrays
難度
Easy
個人範例程式碼
class Solution:
def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
return list(set(nums1) & set(nums2))
最近在練習程式碼本身就可以自解釋的 Coding style,可以嘗試直接閱讀程式碼理解
算法說明
一個 set and 就結束了…
好舒服的 easy 題目…
input handling
set and 的過程會幫我們處理掉
Boundary conditions
x