There are N people labelled from 1 to N . Between these N people, there’s a possibility that one of the people is a werewolf. He’s trying to finish everyone off by disguises himself as the next town mayor.
If the werewolf exists, then :
1. the werewolf trusts nobody
2. everybody (except the werewolf) trust the werewolf (since he's trying to be the next mayor!)
There is exactly 1 person if the werewolf exists.
Given an array of trusts , an array of pair (a,b) representing person with label a trust person with label b return the label of the suspected werewolf. If there is no werewolf, return -1
Example :
N = 2, trusts = [(1,2)]
return 2
N = 3, trusts = [(1,2), (2,3)]
return -1
N = 4, trusts = [(1,3), (1,4), (2,3), (2,4), (4,3)]
return 3
N = 4, trusts = [(1,4), (2,4), (3,4), (4,1)]
return -1