News for hackers. Stuff that matters.
Re:Show HN: Replays of technical interviews with engineers f... by sjroot on Friday September 14, 2018 @03:34AM (#17985387)
A linear solution for this problem is possible under the assumptions that the graph is directed and acyclic. The directed nature of the graph in this particular example is very clear, and because an individual doesn’t forward a message more than once, there are “basically” no cycles.

Had to Google what a Hamiltonian graph was though. I’ve been listening to the musical too much.

Re:Show HN: Replays of technical interviews with engineers f... by pmiller2 on Friday September 14, 2018 @01:29PM (#17989114)
The stated problem does not produce an acyclic graph. For instance, if A has B in their contacts, then B is not forbidden from having A in their contacts. In fact, by ensuring that for all A, if A has B as a contact, then B has A as a contact, we can eliminate directedness from the graph and, via isomorphism, pretend we are operating on an undirected graph.

The requirement that no actor forward a message twice is merely equivalent to finding a simple path through the graph. It does not “basically” mean there are no cycles.

Re:Show HN: Replays of technical interviews with engineers f... by sjroot on Friday September 14, 2018 @06:04PM (#17991397)
I see what you mean, but it just boils down to how you interpret the problem. Specifically, if you focus on the actual forwarding paths instead of the contact lists, the tree structure that enables the linear solution becomes more clear.

As I’m guessing was intended, this problem is particularly well-suited for engineering interviews because you can start with an easy example (the DAG one could derive in this specific interview) then ask the applicant how the solution would change given the additional constraints you’ve described.

Re:Show HN: Replays of technical interviews with engineers f... by pmiller2 on Saturday September 15, 2018 @12:29AM (#17992993)
That’s simply not correct. Do an example. What graph do you draw? That’s the underlying graph that has to be acyclic. Where is this supposed tree structure coming from? Try a dense graph, like with n=5, and every actor having at least 3 contacts.