Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- You want the meetings to end as quickly as possible so that you can allot the more meetings.
- Always take the meeting with the earliest finishing time that doesn’t overlap.
- '''
- class Solution:
- #Function to find the maximum number of meetings that can
- #be performed in a meeting room.
- def maximumMeetings(self,start,end):
- arr=[]
- for i in range(len(start)):
- arr.append([end[i],start[i]]) #sort in increasing order as per the end time
- arr.sort()
- ans=0
- prev_finish=-1
- for i in arr:
- if i[1]>prev_finish: # if current meeting start time is afte the end time of the previous meeting, consider this meeting
- ans+=1
- prev_finish=i[0]
- return ans
Advertisement
Add Comment
Please, Sign In to add comment