Skip to content

Instantly share code, notes, and snippets.

@supritashankar
Created February 12, 2016 19:01
Show Gist options
  • Save supritashankar/15d3db3891f6bf274491 to your computer and use it in GitHub Desktop.
Save supritashankar/15d3db3891f6bf274491 to your computer and use it in GitHub Desktop.
MeetingInvite
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