Created
February 12, 2016 19:01
-
-
Save supritashankar/15d3db3891f6bf274491 to your computer and use it in GitHub Desktop.
MeetingInvite
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 Event { | |
int start; | |
int end; | |
} | |
class myE { | |
int isStart; | |
int time; | |
} | |
void maxparticipants(event[] events){ | |
for(int i=0; i < events.length;i++) | |
{ | |
myEvents.add(new myE{true, events[i].start) | |
myEvents.add(new myE{false, events[i].end) | |
} | |
myEvents.sort(by E Time) | |
int max=0, currentmax = 0; | |
forEach(var item in myEvents){ | |
if(!item.isStart){ | |
currentmax -- ; | |
} | |
else { | |
currentmax ++; | |
if(currentmax > max) { | |
max=currentmax; | |
} | |
} | |
} | |
return max; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment