r/programming • u/svpino • May 08 '15
Five programming problems every Software Engineer should be able to solve in less than 1 hour
https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour
2.5k
Upvotes
1
u/jpapon May 08 '15
Brute forcing it? Isn't that an exhaustive search of the graph?
I think what you're calling "brute force" is a depth first search of the graph, and the only way I can see of doing much better is a dynamic programming solution, but it's going to be much more complicated.
The graph is a tree with ~30k nodes, depth of 9, and max number of edges per node of 3. 6.5k paths seems reasonable.