0997_find-the-town-judge

command
v0.0.0-...-60194e6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2020 License: Unlicense Imports: 0 Imported by: 0

README

0997_find-the-town-judge

题目条件:

  1. town judge 不信赖任何人
  2. town judge 被所有人信赖
  3. 只有一个人符合town judge的条件

遍历trust, 维护两个map

  • map1 记录对他人采取了信赖的人的编号
  • map2 记录被别人信赖, (且未信赖他人的, 如果进行删除操作), town judge候补的被信赖次数

遍历结束后, 遍历map2, 若被信赖次数达到N - 1且这个数唯一, 则是town judge.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL