We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Would you mind sharing how you handled the broken edges when you constructed the directed graph? An example like SMH
TON
RNG
WRO
THG, where I have difficulty visualizing the edge between M and T, or that between H and W.
EDIT: If I didn't get wrong after some reading, those edges were handled with "in-degree zero" as you stated (i.e. the next valid node is a node with no connected edge). And we could confidently remove the smallest node having zero in-degree, without worrying that the answer lies in another node.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #79: Passcode derivation
You are viewing a single comment's thread. Return to all comments →
Would you mind sharing how you handled the broken edges when you constructed the directed graph? An example like
SMH TON RNG WRO THG
, where I have difficulty visualizing the edge betweenM
andT
, or that betweenH
andW
.EDIT: If I didn't get wrong after some reading, those edges were handled with "in-degree zero" as you stated (i.e. the next valid node is a node with no connected edge). And we could confidently remove the smallest node having zero in-degree, without worrying that the answer lies in another node.