Using multiset. Store the open/close times, and count the number of opened meetings at any time

int Solution::solve(vector<vector<int> > &A) {
    multiset<pair<int, int>> ms; int mx=0, open=0;
    for(auto a : A) ms.insert({a[0], 1}), ms.insert({a[1], 0});
    for(auto t : ms) {
        if(t.second) open++;
        else open--;
        mx=max(mx, open);
    return mx;
Click here to start solving coding interview questions