#include <stdio.h>
#include <stdlib.h>
int compare(const void *a, const void *b){
return *(int *)a > *(int *)b;
}
int host = 0;
void minHost(int **table, int n){
int *start = (int *)malloc(sizeof(int) *n);
int *end = (int *)malloc(sizeof(int) *n);
for (int i = 0; i < n; ++i) {
start[i] = table[i][0];
end[i] = table[i][1];
}
qsort(start,n,sizeof(int),compare);
qsort(end,n,sizeof(int),compare);
int num = 0;
int j = 0, k = 0;
for (int i = 0; i < n; ++i) {
for (; j < n && start[j] <= start[i]; j++){
num++;
}
for (; k < n && end[k] <= start[i]; k++){
num--;
}
if(num > host){
host = num;
}
}
}
int main(){
int a1[2] = {5,6};
int a2[2] = {1,3};
int a3[2] = {2,7};
int a4[2] = {4,6};
int a5[2] = {1,2};
int *arr[5] = {a1,a2,a3,a4,a5};
minHost(arr,5);
printf("host mun is : %d\n",host);
}