Status: 2YOE, Self-taught, Management+Leadership B.S., Associate Software Consultant at Appian
Position: L3
Location: Tampa, FL
Date: March 20, 2019
Technical phone screen (1 hour):
Behavioral questions
Algorithm question
interface Monarchy {
void birth(String child, String parent);
void death(String name); // if a person dies, they are removed from monarchy but their children are still considered monarchs
List<String> getOrderOfSuccession();
} king
/ \
a1 a2
/ \ / \
b1 b2 c1 c2
/ \ \
d1 d2 d3Order of Succession: king -> a1 -> b1 -> d1 -> d2 -> b2 -> d3 -> a2 -> c1 -> c2
Example:
Input: King(the first monarch) has 3 children Andy, Bob, Catherine. Andy has one child Matthew. Bob has two children Alex and Asha. Catherine has no children.
Output: [King, Andy, Matthew, Bob, Alex, Asha, Catherine]I chose Python3 as my language and clarified with the interviewer that I am going to make this into a class. Overall the question boiled down to a Pre-Order DFS. I did have to implement a helper class
class Person:
def __init__(self, name):
self.name = name
self.children = []
self.isAlive = TrueFrom here I just created a graph using HashMap where each person is a vertex and their children are linked. Starting at root add the person.name to our return value if person.isAlive and then loop through person.children in a DFS fashion.
During coding this up I did discuss some issues with my implementation such as what happens if two people have the same name and how to handle hash collisions via linear probing, chaining, etc.
Unfortunately I did not proceed to the onsite round, but the feedback was very positive and was requested to re-interview in 3months time.