-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1452.py
25 lines (17 loc) · 812 Bytes
/
1452.py
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
# https://leetcode.com/problems/people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list/
from typing import List
class Solution:
def peopleIndexes(self, favoriteCompanies: List[List[str]]) -> List[int]:
setList = [set(i) for i in favoriteCompanies]
result = []
for i in range(len(setList)):
found = False
for o in range(len(setList)):
if i != o:
if setList[i].issubset(setList[o]):
found = True
break
if not found:
result.append(i)
return result
print(Solution().peopleIndexes([["leetcode","google","facebook"],["google","microsoft"],["google","facebook"],["google"],["amazon"]]))