problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
leetcode::find_players_with_zero_or_one_losses::Solution类 参考

#include <leetcode.h>

静态 Public 成员函数

static vector< vector< int > > findWinners (vector< vector< int > > &matches)
 

详细描述

在文件 leetcode.h2047 行定义.

成员函数说明

◆ findWinners()

vector< vector< int > > leetcode::find_players_with_zero_or_one_losses::Solution::findWinners ( vector< vector< int > > &  matches)
static

在文件 leetcode.cpp5555 行定义.

5555 {
5556 map<unsigned, unsigned> lose;
5557 for(auto match: matches) {
5558 lose[match[0]] += 0;
5559 lose[match[1]] += 1;
5560 }
5561 vector<vector<int>> ans(2);
5562 vector<int> ans1;
5563 vector<int> ans2;
5564 for(auto [player, count]: lose) {
5565 if(count == 0) {
5566 ans1.push_back(player);
5567 } else if(count == 1) {
5568 ans2.push_back(player);
5569 }
5570 }
5571 ans[0] = ans1;
5572 ans[1] = ans2;
5573 return ans;
5574 }

被这些函数引用 leetcode::find_players_with_zero_or_one_losses::TEST().


该类的文档由以下文件生成: