Created
May 17, 2020 10:46
-
-
Save aljorhythm/9901712c315b7c84a0e972e6a14d5693 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution(object): | |
def peopleIndexes(self, favoriteCompanies): | |
indices = [] | |
favoriteCompanies = map(set, favoriteCompanies) | |
for i, person in enumerate(favoriteCompanies): | |
has_subset = False | |
for j, otherPerson in enumerate(favoriteCompanies): | |
if i == j: | |
continue | |
is_subset = True | |
for c in person: | |
if c not in otherPerson: | |
is_subset = False | |
break | |
if is_subset: | |
has_subset = True | |
break | |
if not has_subset: | |
indices.append(i) | |
return indices |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment