Clique of three
Description:
Given a list of friend pairs, find a clique of three (a.k.a. triangle): a group of three people who are all friends with each other.
For example, given the input
Harry/Ron
Ron/Hermione
Harry/Hermione
Hermione/Lavender
you should return
Harry/Ron/Hermione
The order of the three names in the returned string does not matter.
If there is no clique-of-three, return an empty string.
The members of a clique-of-three must be three different people. In particular, a person who claims to be his own friend does not constitute a clique-of-three all by himself.
The input consists of zero or more lines, one line per friend pair. Each line is terminated by the newline character '\n' and contains exactly one '/' character to separate the two names. The names are non-empty strings. Names may contain spaces or punctuation (but not the '/' or newline characters).
The largest test cases contain up to 750 unique names.
Similar Kata:
Stats:
Created | Jul 15, 2019 |
Published | Sep 10, 2023 |
Warriors Trained | 296 |
Total Skips | 43 |
Total Code Submissions | 455 |
Total Times Completed | 49 |
C++ Completions | 28 |
Java Completions | 23 |
Total Stars | 13 |
% of votes with a positive feedback rating | 90% of 20 |
Total "Very Satisfied" Votes | 16 |
Total "Somewhat Satisfied" Votes | 4 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 7 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |