1
2
3
4
5
6
7
8
9
10
11
|
class Solution:
def twoOutOfThree(self, nums1: List[int], nums2: List[int], nums3: List[int]) -> List[int]:
ans=[]
for i in nums1:
if i in nums2 or i in nums3: ans.append(i)
for i in nums2:
if i in nums1 or i in nums3: ans.append(i)
for i in nums3:
if i in nums2 or i in nums1: ans.append(i)
ans= list(set(ans))
return ans
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 2124. Check if All A's Appears Before All B's (0) | 2022.03.21 |
---|---|
leetcode 1460. Make Two Arrays Equal by Reversing Sub-arrays (0) | 2022.03.21 |
leetcode 1880. Check if Word Equals Summation of Two Words (0) | 2022.03.21 |
leetcode 2053. Kth Distinct String in an Array (0) | 2022.03.21 |
leetcode 2057. Smallest Index With Equal Value (0) | 2022.03.21 |
댓글