1class Solution {2public:3static bool cmp(vector<int> &a, vector<int> &b) {4if (a[0] != b[0]) return a[0] > b[0];5return a[1] < b[1];6}78int numberOfWeakCharacters(vector<vector<int>> &properties) {9sort(properties.begin(), properties.end(), cmp);1011int res = 0, mx = INT_MIN;12for (auto p : properties) {13if (mx > p[1])14res++;15else16mx = p[1];17}18return res;19}20};