Algorithm · Amazon · Medium
You receive a collection of web-navigation entries. Each entry has three fields: user_id, source_url, and destination_url. An entry indicates that the user moved from source_url to destination_url in one step. Treat every distinct ordered pair (source_url, destination_url) as a directed edge in a graph whose vertices are URLs. Repeated entries that produce the same ordered pair should be collapsed into one edge for the purpose of defining the graph. Given two URLs, url1 and…
Checking your access…