Skip to content

Instantly share code, notes, and snippets.

@P1n3appl3
Created January 25, 2017 05:58
Show Gist options
  • Save P1n3appl3/7e201e60b002563cd0a6e90a9e71f1cc to your computer and use it in GitHub Desktop.
Save P1n3appl3/7e201e60b002563cd0a6e90a9e71f1cc to your computer and use it in GitHub Desktop.
coding challenge from dropbox
class Meeting(object):
def __init__(self, start, end):
self.start = start
self.end = end
def __str__(self):
return str(self.start) + ', ' + str(self.end)
def schedule(times):
times.sort(key=lambda m: m.start)
rooms = [times[0]]
maxRooms = 1
for t in times[1:]:
rooms = [i for i in rooms if i.end > t.start] + [t]
maxRooms = max(maxRooms, len(rooms))
return maxRooms
meetingList = [
Meeting(start=10, end=17),
Meeting(start=23, end=30),
Meeting(start=15, end=25),
]
print schedule(meetingList)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment