Personally, as an interviewer I would be looking for a graph traversal a la breadth first search within an arbitrary graph structure (adjacency list, et al). This seems like it could work though.
I will definitely look into your suggestion, because if it's the optimal solution, I want it to be the first one I think of. Even though these types of problems don't come up for me that often, I'm sure there are times where a textbook CS solution would have been the best solution.