Created
February 11, 2016 01:54
-
-
Save supritashankar/c4aa542c17238d20c191 to your computer and use it in GitHub Desktop.
Meeting Calendar problem with sets
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
timeline = { | |
'1': set([0,1,2,3,4]), | |
'2': set([3,4,5,6,7]), | |
'3': set([2,3,4])} | |
def get_meeting_time(timeline): | |
""" | |
get intersection of all the person | |
""" | |
res = set([0,1,2,3,4,5,6,7,8,9]) | |
maxres = set() | |
for x in timeline: | |
y = set(timeline[x]) | |
res = y & res | |
if len(res) != 0: | |
maxres = res | |
print maxres | |
get_meeting_time(timeline) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment