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. jumpserver 安装

    # CentOS 7 安装jumpserver $ setenforce 0 # 可以设置配置文件永久关闭$ systemctl stop iptables.service$ systemctl st ...

  2. 模拟赛 怨灵退治 题解(Hall定理+线段树)

    题意: 有 n 群怨灵排成一排,燐每秒钟会选择一段区间,消灭至多 k 只怨灵. 如果怨灵数量不足 k,则会消灭尽量多的怨灵. 燐作为一只有特点的猫,它选择的区间是不会相互包含的.它想要知道它每秒最多能 ...

  3. Win32 Error Code COM Error Code NTSTATUS的区别、转换

    这三种码其实都是Windows系统错误码,只是对应不同API和使用场景.它们既有区别,又相互有联系. 一.区别和联系 都是32位值 Win32 Error Code和NTSTATUS位域组成相同,但W ...

  4. Processing玩抠图

    突然兴起想玩一下抠图,试着用自带的Example\video来改,花了一个中午做了个小样: 分别是白色为底与黑色为底的效果,代码如下: import processing.video.*; int n ...

  5. (2)Angular的开发

    什么是 ReactNative应用, 小程序与RN的关系 native端优化 Js端优化 ReactNative是? 用JavaScript来写App,性能好 异步编程 请点赞!因为你的鼓励是我写作的 ...

  6. PHP隐藏入口脚本文件index.php

    一.nginx下 隐藏入口文件时,配置nginx 首先得开启nginx pathinfo模式: location ~ \.php { #去掉$ root E:/phpStudy/WWW/tp/publ ...

  7. UOJ#339. 【清华集训2017】小 Y 和二叉树 贪心

    原文链接 www.cnblogs.com/zhouzhendong/p/UOJ339.html 前言 好久没更博客了,前来更一发. 题解 首先,我们考虑一个子问题:给定根,求出最小中序遍历. 如果根节 ...

  8. shell 一次性杀掉相同名称的进程

    这条命令将会杀掉所有含有关键字"LOCAL=NO"的进程 ps -ef|grep LOCAL=NO|grep -v grep|cut -c -|xargs kill - 另一种方法 ...

  9. leaflet control.layers踩的一个坑

    Control.Layers方法 该方法可以创建一个切换图层的工具, L.control.layers(baseLayers, overlayers).addTo(map); baseLayers参数 ...

  10. ICEM-气化炉

    原视频下载地址:https://yunpan.cn/cuPJWRHUJKXIL  访问密码 d379