problem

997. Find the Town Judge

solution:

class Solution {
public: int findJudge(int N, vector<vector<int>>& trust) {
vector<int> balance(N+);
for(auto t:trust) { balance[t[]]--; balance[t[]]++; }
for(int i=; i<=N; i++)
{
if(balance[i]==N-) return i;
}
return -;
}
};

参考

1. Leetcode_easy_997. Find the Town Judge;

【Leetcode_easy】997. Find the Town Judge的更多相关文章

  1. 【leetcode】997. Find the Town Judge

    题目如下: In a town, there are N people labelled from 1 to N.  There is a rumor that one of these people ...

  2. 【LeetCode】997. Find the Town Judge 解题报告(C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 度 日期 题目地址:https://leetcode ...

  3. #Leetcode# 997. Find the Town Judge

    https://leetcode.com/problems/find-the-town-judge/ In a town, there are N people labelled from 1 to  ...

  4. 【HDU5391】Zball in Tina Town

    [题目大意] 一个球初始体积为1,一天天变大,第一天变大1倍,第二天变大2倍,第n天变大n倍.问当第 n-1天的时候,体积变为多少.注意答案对n取模. [题解] 根据威尔逊定理:(n-1)! mod ...

  5. 【Leetcode_easy】1021. Remove Outermost Parentheses

    problem 1021. Remove Outermost Parentheses 参考 1. Leetcode_easy_1021. Remove Outermost Parentheses; 完

  6. 【Leetcode_easy】1022. Sum of Root To Leaf Binary Numbers

    problem 1022. Sum of Root To Leaf Binary Numbers 参考 1. Leetcode_easy_1022. Sum of Root To Leaf Binar ...

  7. 【Leetcode_easy】1025. Divisor Game

    problem 1025. Divisor Game 参考 1. Leetcode_easy_1025. Divisor Game; 完

  8. 【Leetcode_easy】1029. Two City Scheduling

    problem 1029. Two City Scheduling 参考 1. Leetcode_easy_1029. Two City Scheduling; 完

  9. 【Leetcode_easy】1030. Matrix Cells in Distance Order

    problem 1030. Matrix Cells in Distance Order 参考 1. Leetcode_easy_1030. Matrix Cells in Distance Orde ...

随机推荐

  1. 2019/8/27 Test(luogu 五月天模拟赛)

    \(2019/8/27\)大考 \(\color{#ff0808}{\text{初二诀别赛(SAD)}}\) 题目名称 链接 寿司 \(BSOJ5111\) 秀秀的森林 \(BSOJ5125\) 分组 ...

  2. LOJ P10065 北极通讯网络 题解

    每日一题 day39 打卡 Analysis 1.当正向思考受阻时,逆向思维可能有奇效. 2.问题转化为:找到最小的d,使去掉所有权值>d的边之后,连通支的个数<k; 3.定理:如果去掉所 ...

  3. linux ps命令查看最消耗CPU、内存的进程

    1.CPU占用最多的前10个进程: ps auxw|head -1;ps auxw|sort -rn -k3|head -10 2.内存消耗最多的前10个进程 ps auxw|head -1;ps a ...

  4. DVWA暴力破解练习

    本周学习内容: 1.结合DVWA学习Web应用安全权威指南 实验内容: 使用BurpSuite工具进行DVWA暴力破解 实验步骤: 1.打开DVWA,进入DVWA Security模块将 Level修 ...

  5. 【CPLEX教程01】Cplex介绍,下载和安装Cplex

    前言 最近学习列生成算法,需要用到优化求解器.所以打算学习一下cplex这个商业求解器. 当然也有其他更多的选择,这里暂时以比较容易上手和性能比较好的cplex开始吧.其实,小编也早就想学习使用这个c ...

  6. 《挑战30天C++入门极限》C++的iostream标准库介绍(2)

        C++的iostream标准库介绍(2) 接下来我们继续看一下C++风格的串流控制,C++引入了ostringstream.istringstream.stringstream这三个类,要使用 ...

  7. docker run 参数含义

    -a stdin: 指定标准输入输出内容类型,可选 STDIN/STDOUT/STDERR 三项: -d: 后台运行容器,并返回容器ID: -i: 以交互模式运行容器,通常与 -t 同时使用:     ...

  8. Zrender:实现波浪纹效果

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  9. Percona,MariaDB,MySQL衍生版如何取舍

    缘起 自从甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险.而且Oracle对培养MySQL这个免费的儿子并不太用心,漏洞修补和版本升级的速度一段时间非常缓慢,所以业界对MySQL的未来普遍 ...

  10. Mysql 查看所有线程,被锁的表

    查看所有MySQl相关的线程 show full processlist; 杀死线程id为2的线程 kill 2 查看服务器状态 show status like '%lock%'; 查看服务器配置参 ...