Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - bool compare(Meeting *a, Meeting *b){
 - return a->start<b->start || (a->start==b->start && a->end<b->end);
 - }
 - int getMaxMeetings(vector<Meeting*> &meetings) {
 - sort(meetings.begin(),meetings.end(),compare);
 - int start=0,end=0,count=0;
 - for(auto i:meetings){
 - Meeting *temp=i;
 - if(start==0 || temp->start>end){
 - start=temp->start,end=temp->end;
 - count++;
 - }
 - }
 - return count;
 - }
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment