1
class Solution {
2
public:
3
static bool cmp(vector<int> &a, vector<int> &b) {
4
if (a[0] != b[0]) return a[0] > b[0];
5
return a[1] < b[1];
6
}
7

8
int numberOfWeakCharacters(vector<vector<int>> &properties) {
9
sort(properties.begin(), properties.end(), cmp);
10

11
int res = 0, mx = INT_MIN;
12
for (auto p : properties) {
13
if (mx > p[1])
14
res++;
15
else
16
mx = p[1];
17
}
18
return res;
19
}
20
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0