#include <leetcode.h>
◆ numberOfWeakCharacters()
int leetcode::the_number_of_weak_characters_in_the_game::Solution::numberOfWeakCharacters |
( |
vector< vector< int > > & | properties | ) |
|
|
static |
< 最大防御值
在文件 leetcode.cpp 第 1765 行定义.
1765 {
1766
1767 sort(properties.begin(), properties.end(), [](const vector<int> &a, const vector<int> &b) { return a[0] == b[0] ? a[1] < b[1] : a[0] > b[0]; });
1768
1769 int maxDef = 0;
1770 int count = 0;
1771 for(const auto &p: properties) {
1772 if(p[1] < maxDef) {
1773 count++;
1774 } else {
1775 maxDef = p[1];
1776 }
1777 }
1778 return count;
1779 }
该类的文档由以下文件生成: