Software Engineer • Senior-Level
Software Engineer • Senior-Level
High QualityPrep Other Coding Questions Asked by Anthropic
Continue with targeted prep from Anthropic's coding question bank.
Interview Summary
I recently had a technical phone screen with Anthropic focused on implementing a concurrent web crawler. The interview started with a single-threaded implementation and then introduced multithreading, requiring careful handling of URL deduplication, shared state, and crawler termination. The basic graph traversal was straightforward, but the concurrency requirements made the problem considerably more challenging than a standard BFS exercise.
Interview Details
Round 1 — Coding: Concurrent Web Crawler
The interviewer asked me to implement a web crawler that discovers all URLs belonging to the same hostname as a starting URL. I was given two inputs:
startUrl: The URL where crawling begins.htmlParser: An interface for retrieving links from a web page.
The goal was to traverse reachable pages and return all URLs whose hostnames exactly matched the hostname of startUrl. The interview was divided into two stages: a single-threaded implementation followed by a concurrent version.
https://www.chillinterview.com/learn/coding-interview-questions/concurrent-help-center-article-crawler is a similar question to practice.
Part 1 — Single-Threaded Web Crawler
The initial task was to implement the crawler using a single thread. At first, I thought this would be a straightforward BFS problem. However, the interviewer specified several important requirements that made the implementation more subtle.
-
Requirement 1 — Exact Hostname Matching The crawler should only include URLs whose hostnames exactly match the hostname of the starting URL. A partial hostname match was not sufficient.
-
Requirement 2 — URL Fragment Normalization Before comparing URLs or checking whether
Unlock Full Details
Create a free account to unlock this interview experience report.