intSolution::solve(vector<vector<int> > &A){ sort(begin(A), end(A)); priority_queue<int, vector<int>, greater<int>> q; int l = 0, r = 0, n = A.size(), res = 0; while(r < n) { int s = A[l][0], e = A[r][0]; while(q.size() and q.top() <= s) q.pop(); while(r < n and A[r][0] == s) q.push(A[r++][1]); res = max(res, (int)q.size()); l = r; } return res; }