Spies! Expose the dirty double crossers
Description:
A well-known fact; spies double-cross. Not only do they monitor persons of interest, they often monitor- and possibly double-cross- other friendly spies.
As the new director of the Central Spy Agency you are going to clean house. You want to start by getting rid of the spies who are spying on each other. You've managed to obtain dossiers for each spy summarizing their clandestine activity. Each dossier contains information about the persons (including other spies in your agency) the agent monitors.
If spy Roger Cly is spying on spy Jacques 1 & Jacques 3 and Jacques 1 is spying on Roger Cly and Jacques 3, and Jacques 3 is spying on Roger Cly & Jacques 1 then you have found a double-crossing ring of 3. All three are spying on one another.
Given a summary of all the dossiers [(x, xs)], find the largest double-crossing ring in your organization.
Ex 1:
[("Roger Cly",["Jacques 1","Jacques 3"]), ("Jacques 3",["Jacques 1","Roger Cly"]), ("Jacques 1",["Roger Cly","Jacques 3"])] ```
has a largest double crossing ring size of
```3```
Ex 2:
``` haskell
[(1,[6,7]), (2,[1,3]), (3,[1,2])]```
has a largest doublecrossing ring size of ```2``` i.e. double crossing ring of 2 & 3
Ex 3:
```haskell
[('a',['b']), ('b',['a'.'c']), ('c',['b'])]```
has a largest doublecrossing ring size of ```2``` i.e. double crossing rings of size 2 are a & b and b & c
<p>
Ex 4:
If no spies are double crossing each other then the largest spyring size is ```1```.
Similar Kata:
Stats:
Created | Feb 28, 2017 |
Warriors Trained | 36 |
Total Skips | 6 |
Total Code Submissions | 88 |
Total Times Completed | 1 |
Haskell Completions | 1 |
Total Stars | 4 |
% of votes with a positive feedback rating | 0% of 0 |
Total "Very Satisfied" Votes | 0 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 0 |