Sorting Flashcards
1
Q
Maximum Intervals Overlap O(nlogn) - given entry and exit times, find maximum people in the party and time at which people are maximum.
A
define ll long long
#include using namespace std;
int main() { ll t; cin>>t; while(t--) { ll n,i,j,maxm=-1,ttime=0,people=0; cin>>n; ll entry[n],exi[n]; for(i=0;i>entry[i]; } for(i=0;i>exi[i]; } sort(entry,entry+n); sort(exi,exi+n); i=1,j=0; maxm=1; people=1; ttime = entry[0]; while(imaxm) { maxm=people; ttime = entry[i]; } i++; } } cout