Anonymous · shared experience20 Jan 2023 · 5 views
Standard Chartered: Minimum edge reversals so every node is reachable in a tree
Problem. You get a tree whose edges have directions. Work out the minimum number of edges to reverse so that every node can be reached from a starting node. It was the harder of two problems in the online coding test.
Pitfall. The candidate had the right idea but kept the reversed edges in a set, and the lookups were slow enough to time out on 6 of 15 tests. Pay attention to the cost of every lookup, not just the big-O of the traversal.
Comments 0
No comments yet. Ask the author something, or add what happened in your own round.