The following snippet was pasted in the code editor the block itself contains the question so to say. I apologize if the post and the problem statement do not match. I gave this interview a long time back with no preparation.
Given 2 names of the people, determine the "chain" of invitees a person invited to the party.
I could not even write a bruteforce solution to this,( I believe? it smells like Strongly Connected components? unless someone else has a better approach
How to read the input:
PersonA -invited-> PersonB
// Mingtao,Kendyl
// Kendyl,Hamza
// Kendyl,Dayana
// Dayana,Miya
// Dayana,Kian
// Dorian,Brendan
// Dorian,Brooks
// Amari,Mckinley
// Amari,Yandel
// Yandel,Adalyn
// Yandel,Ariella
// Hamza,Terry
// Hamza,Dorian
// Terry,Abby
// -------
Example 1:
// input:
Mingtao, Kian
// output:
Mingtao invited Kendyl
Kendyl invited Dayana
Dayana invited Kian
// Example 2
//input:
Brooks, Kian
// output:
Brooks was invited by Dorian
Dorian was invited by Hamza
Hamza was invited by Kendyl
Kendyl invited Dayana
Dayana invited Kian
//This is the way the input is provided to your function:
people inviter -> invitees
{"mingtao" -> ("kendyl"), "kendyl" -> ("Hamza", "dayana"), "dayana" -> ("miya", "kian")}
Hope this helps.