It seems like at this company the hiring manager only looks at your resume after you pass the phone screen. First I talked with the recruiter, and then right there on that call they said they'd schedule the phone screen — a one-hour coding round.
The interviewer didn't waste any time either. After about 5 minutes of introducing ourselves, we went straight into the problem. It was written on CoderPad, split into several parts, and for each part you had to write your own test cases — only after your code passed would the interviewer paste in the next part.
Here's the full problem:
# Part 1
Create a class that tracks customer transactions. The class should identify which customers have transacted together at any given time.
Example:
Have Jim and Pam ever transacted together? -> No
Jim pays Pam
Have Jim and Pam ever transacted together? -> Yes
Pam pays Michael
Have Michael and Jim ever transacted together? -> No
Part 2
Given a customer, find their network.
A person's network is considered everyone they have directly transacted with, all of the people their direct connections transacted with, and all of their 2nd degree connections transacted with, etc..
Example 1 -
// [g]-[f]
//
// [a]-[b]-[c]
// |
// [d]-[e]
Transactions t([a, b], [b, c], [a, d], [d, e], [g,f])
t.findNetwork(a) // [b,c,d,e]
t.findNetwork(g) // [f]
Example 2 -
// [a]-[b]
// | |
// [c]-[d]
Transactions t([a, b], [b, d], [d, c], [c, a])
t.findNetwork(a) // [b,c,d]
Part 3
Add a second parameter to the method made in the previous part, n, which will limit the network size based on the number of degrees of separation away from the target individual.
Example 1 - isolated networks
// [g]-[f]
// [a]-[b]-[c]
// |
// [d]--[e]
Transactions t([a, b], [b, c], [a, d], [d, e], [g,f])
t.findNetwork(a, 1) // [b,d]
t.findNetwork(g, 1) // [f]
Example 2 - network with loop
// [a]-[b]
// | |
// [c]--[d]
Transactions t([a, b], [b, d], [d, c], [c, a])
t.findNetwork(a,1) // [b,c]
Example 3 - large interspersed network
// [a]--[b]--[c]--[d]
// | |
// [e] [f]--[g]--[h]
Transactions t([a, b], [b, c], [c, d], [b, e], [c,f], [d,g], [f,g], [g,h])
t.findNetwork(d,2) // [c, g, b, f, h]
t.findNetwork(h,3) // [g, d, f, c]
t.findNetwork(a,1) // [b]
My approach was: build a graph for Part 1, write BFS for Part 2, and BFS with a depth limit for Part 3. Overall it wasn't that hard — you just needed to read fast and code fast, since writing your own test cases really does eat up time.
Also, for almost every part you had to refactor the code you'd already written — the interviewer would ask you to refactor first before writing anything new.
The day after the interview, the recruiter said the feedback would go to the hiring manager to decide whether there'd be a virtual onsite. Then a day later they told me the hiring manager's read was "very positive," but the team I'd interviewed for — Data Platform — had just extended an offer to someone else, so I'd need to be re-matched with a different team.
Discussion
Loading comments…