Back to problems

Domain Score Accumulation (Reverse Trie)

Algorithm · Amazon · Medium

Requirements Every domain name is associated with an integer value. Domain names form a dot-delimited hierarchy, such as org, site.org, and api.site.org. For each leaf domain (a domain with no subdomains in the input), compute its value by adding the scores for that hostname and all of its suffix domains, continuing through the top-level domain. Produce the resulting total for every leaf domain. Examples api.site.org totals its own score together with site.org and org.…

Checking your access…