Notice
Recent Posts
Recent Comments
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
Tags
- AI 경진대회
- Kaggle
- gs25
- 편스토랑 우승상품
- 자연어처리
- 코로나19
- 우분투
- Real or Not? NLP with Disaster Tweets
- PYTHON
- programmers
- 금융문자분석경진대회
- ChatGPT
- leetcode
- ubuntu
- 프로그래머스 파이썬
- 파이썬
- 편스토랑
- Baekjoon
- 더현대서울 맛집
- dacon
- Docker
- 캐치카페
- Git
- 프로그래머스
- github
- SW Expert Academy
- hackerrank
- 데이콘
- 백준
- 맥북
Archives
- Today
- Total
솜씨좋은장씨
[leetCode] 349. Intersection of Two Arrays (Python) 본문
728x90
반응형

Given two arrays, write a function to compute their intersection.
Example 1:
Input: nums1 = [1,2,2,1], nums2 = [2,2]
Output: [2]
Example 2:
Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4]
Output: [9,4]
Note:
- Each element in the result must be unique.
- The result can be in any order.
Solution
class Solution:
def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
return list(set(nums1) & set(nums2))



SOMJANG/CODINGTEST_PRACTICE
1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.
github.com
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
| [leetCode] 1528. Shuffle String (Python) (0) | 2020.08.02 |
|---|---|
| [leetCode] 884. Uncommon Words from Two Sentences (Python) (0) | 2020.07.31 |
| [leetCode] 1185. Day of the Week (Python) (0) | 2020.07.29 |
| [leetCode] 260. Single Number III (Python) (0) | 2020.07.29 |
| [leetCode] 445. Add Two Numbers II (Python) (0) | 2020.07.27 |
Comments